/*============================================================================*/
/*  Copyright (C) 2009-2011, iSOFT INFRASTRUCTURE SOFTWARE CO.,LTD.
 *
 *  All rights reserved. This software is iSOFT property. Duplication
 *  or disclosure without iSOFT written authorization is prohibited.
 *
 *  @file       <Com.c>
 *  @brief      <COM>
 *
 *  <Compiler: MinGW20120426    MCU:NONE>
 *
 *  @author     <Dongliang.Chen>
 *  @date       <2014-06-28>
 */
/*============================================================================*/

/*=======[R E V I S I O N   H I S T O R Y]====================================*/
/*  <VERSION>    <DATE>    <AUTHOR>    <REVISION LOG>
 *  V1.0.0     20140217  Dongliang.Chen Initial version
 *                             &        Add Requirements of AutoSAR Com 4.0 R1 As followed:
 *                       Song.Wang      COM578_Conf
 *                                      COM650, COM651, COM124, COM652, COM725, COM691, COM654,
 *                                      COM655, COM656, COM657, COM721, COM692, COM658, COM693,
 *                                      COM663
 *  V1.0.1     20140702  Song.Wang      optimize the ipdu group start function code. 
 *                                      mark: SW201401
 *  V1.0.1     20140702  Song.Wang      optimize the ipdu group stop function code. 
 *                                      mark: SW201402
 *  V1.0.1     20140703  Song.Wang      optimize the Com_EnableReceptionDM function code. 
 *                                      mark: SW201403
 *  V1.0.1     20140703  Song.Wang      optimize the Com_DisableReceptionDM function code. 
 *                                      mark: SW201404
 *  V1.0.1     20140703 Dongliang.Chen  1. Modify: OccureCntr is instead of OccurenceCntr.
 *                                         Mark: DL201401
 *                                      2. Modify: Com_IPduGroupStart, Occurence Cntr is 0u.
 *                                         Mark: DL201402
 *                                      3. Modify: When IPduGroup is Stopped & IPdu is not confirmed,
 *                                         Call Error notification, not TxOut notification.
 *                                         Mark: DL201403
 *                                      4. Modify: Com_TxDMTOutNotif to Macro Function Com_TxDMTOutNotifMF.
 *                                         Mark: DL201404
 *                                      5. Modify: Add break in Com_IPduGroupStart.
 *                                         Mark: DL201405
 *                                      6. Modify: Some operation about set Confirm Flag of TxIPdu.
 *                                         Mark: DL201406
 *  V1.0.1     20140707  Song.Wang      add isr stop-open in Com_InvalidateSignalGroup. 
 *                                      mark: SW201405
 *  V1.0.1     20140708 Dongliang.Chen  1. Modify: Direct/N component, set N Times & N Period in
 *                                         actual send to lower layer.
 *                                         mark: DL201407
 *                                      2. Delete no used Tx Runtime IPdu Flag, COM_RT_TXIPDUFLAG_LAST_TMS_MASK.
 *                                         mark: DL201408
 *                                      3. Delete repeat set of COM_RT_TXIPDUFLAG_DELAY_MASK Flag in SendSignal
 *                                         and SendSignalGroup. Because COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK and
 *                                         COM_RT_TXIPDUFLAG_DELAY_MASK is the same purpose.
 *                                         mark: DL201409
 *                                      4. Add: COM_RT_TXIPDUFLAG_DELAYPENDTX, to mark the TMS changes & Delayed send
 *                                         is Periodic component(In MainfunctionTx would use this Flag)
 *                                         mark: DL201410
 *                                      5. Modify: Com_TxConfirmation Process is used only COM_RT_TXIPDUFLAG_CONF_MASK is
 *                                         TRUE.
 *                                         mark: DL201411
 *                                      6. Add: The First Send of Direct/N Times Component should check CalloutFunction.
 *                                         mark: DL201412
 *                                      7. Optimize: Delete Tx Runtime IPdu Flag, COM_RT_TXIPDUFLAG_TMSCHAINMDT, because
 *                                         it is can be instead of COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK.
 *                                         mark: DL201413
 *                                      8. Modify: Send_API with TMS changed, Period Timer would start at actual send to
 *                                         lower layer.
 *                                         mark: DL201414
 *                                      9. Modify: Clear COM_RT_TXIPDUFLAG_DELAY_MASK in each TxMode MainFunction.
 *                                         mark: DL201415
 *                                     10. Delete: In Send_API, If MDT is not Timeout, do not give value to
 *                                         N, NTimer, PeriodTimer of IPdu.
 *                                         mark: DL201416
 *                                     11. Modify: Get COM_RT_TXIPDUFLAG_TMSCHAINMDT Flag back, In case of TMS no Changes,
 *                                         It does not reset Periodic Timer on first delay send.
 *                                         mark: DL201417
 *                                     12. Add COM_UPDATEBIT_ENABLE Macro Control.
 *                                         mark: DL201418
 *                                     13. Add COM_FILTER_ENABLE Macro Control.
 *                                         mark: DL201419
 *                                     14. Add COM_GATEWAY_ENABLE Macro Control.
 *                                         mark: DL201420
 *                                     16. Modify: Clear updatebit only when IPdu is send out.
 *                                         mark: DL201422
 *                                     17. Add: DM to 0 when RxIPduGroupStop.
 *                                         mark: DL201423
 *  V1.0.2     20140811 Dongliang.Chen  1. Modify: Com_SendSignal only pack signal value to TxIPdu on signal value changed,
 *                                                 except signal type is Uint8N.
 *                                         mark: DL201424
 *                                      2. Modify: Because Index Addressing changes from "Start+Num" to "Start+Stop".
 *                                         mark: DL201425
 *                                      3. Modify: ID Addressing Error, Not Index, but ID.
 *                                         mark: DL201426
 *                                      4. Move: Move this Variate out of For-Loop.
 *                                         mark: DL201427
 *                                      5. Add: Com_Gateway Rx IPdu Id Array.
 *                                         mark: DL201428
 *                                      6. Delete: comGwDestDescInvValIndex of Com_GWDestination_Type
 *                                      7. Add: Destination Description add Filter.
 *                                         mark: DL201429
 *                                      8. Modify: Clear updatebit of description when called IPduGroupStart.
 *                                         mark: DL201430
 *                                      9. Modify: Uint8N can be Cfged Big-Endianess or Little-Endianess.
 *                                         mark: DL201431
 *                                     10. Clear: Clear Warning item by CodeWarrior 2.10
 *                                         mark: DL201432
 *                                     11. Modify: Add 1Bit in RxIPdu PBFlag to show it is Gateway IPdu.
 *                                         mark: DL201433
 *                                     12. Modify: RxUnpack & Pack function and other influence codes.
 *                                         mark: DL201434
 *                                     13. Modify: make Com_TxSetSignalBuff & Com_SendSignalChanged together,
 *                                                 & its Index(By Song.Wang)
 *                                         mark: DL201435
 *                                     14. Add: add one flag in txIpduRtimeFlag.
 *                                         mark: DL201436
 *                                     15. Modify: RxGwIPduNumber & TxGwIPduNumber is PB.
 *                                         mark: DL201437
 *  V1.0.3     20140910  Song.Wang      change Com_UpdateShadowSignal to fit
 *                                                    gateway needing, then Com_UpdateShadowSignal 
 *                                                    only call a internal function  called
 *                                                    Com_UpdateShadowSignalInternal.      
 *                                         mark: SW201406
 *  V1.0.4     20140910  Song.Wang      add function Com_UpdateShadowSignalInternal.
 *                                         mark: SW201407
 *  V1.0.5     20140910  Song.Wang      change calling from Com_UpdateShadowSignal
 *                                                   to Com_UpdateShadowSignalInternal. 
 *                                         mark:SW201408
 *  V1.0.6     20140910  Song.Wang      add COM_GATEWAY_ENABLE macro using
 *                                         mark:SW201409
 *  V1.0.7     20140910  Song.Wang      add GetRxDescUpdatebit macro for gateway
 *                                         mark:SW201410
 *  V1.0.8     20140911  Song.Wang      Modify update get macro function for optimation
 *                                         mark:SW201411
 *  V1.0.9     20140911  Song.Wang      add Com_DescDestBuffSet macro function for gateway.
 *                                         mark:SW201412
 *  V1.0.10     20140911  Song.Wang      add Com_GetTMParamWithTMSRst macro function for
 *                                                    getting transmit parameter based on TMS calculation result.
 *                                         mark: SW201414
 *  V1.0.11     20140912  Song.Wang      modify  Com_IpduHandleInSendSignal  and
 *                                                    Com_IpduHandleInSendSignalGrp function to 
 *                                                    fit gateway requirements. 
 *                                         mark: SW201415
 *  V1.0.12     20140912  Song.Wang      modify  Com_IpduHdlBefMDTForSignal to
 *                                                    fit gateway requirements. 
 *                                         mark: SW201416  
 *  V1.0.13     20140915  Song.Wang      add Com_GtwDescToDesc8NDirectCopy function for gateway.
 *                                         mark:SW201419
 *  V1.0.14     20140915  Song.Wang      add Com_GtwDescToSignal8NDirectCopy function for gateway.
 *                                         mark:SW201420
 *  V1.0.15     20140915  Song.Wang      add Com_GtwSignalToDesc8NDirectCopy function for gateway.
 *                                         mark:SW201421
 *  V1.0.16     20140915  Song.Wang      add Com_GtwSignalToSignal8NDirectCopy function for gateway.
 *                                         mark:SW201423
 *  V1.0.17     20140916  Song.Wang      add Com_GwyDescSendHandle function for gateway.
 *                                         mark:SW201424
 *  V1.0.18     20140916  Song.Wang      add Com_GwySignalSendHandle function for gateway.
 *                                         mark:SW201425
 *  V1.0.19     20140916  Song.Wang      add Com_GwyDSSrcMapHandle function for gateway.
 *                                         mark:SW201426
 *  V1.0.20     20140916  Song.Wang      add Com_GwySignalGrpUpdateShadowBuff function for gateway.
 *                                         mark:SW201427
 *  V1.0.21     20140916  Song.Wang      add Com_GwySignalGrpSendHandle function for gateway.
 *                                         mark:SW201428 
 *  V1.0.22     20140916  Song.Wang      add Com_GwySignalGrpSrcMapHandle function for gateway.
 *                                         mark:SW201429
 *  V1.0.23     20140917  Song.Wang      add update macro limit for parameter updateBitStat of
 *                                                    Com_Rx8NSignalHandle and Com_RxSignalHandle function.
 *                                         mark:SW201430
 *  V1.0.24     20140917  Song.Wang      add update macro limit for parameter txMode of
 *                                                    Com_MainFuncTxPeriod function. 
 *                                         mark:SW201431
 *  V1.0.25     20140918  Song.Wang      add det dispose for Com_TriggerIPDUSend function.
 *                                         mark:SW201432
 *  V1.0.26     20140918  Song.Wang      add det dispose for Com_TriggerTransmit function.
 *                                         mark:SW201433
 *  V1.0.27     20140918  Song.Wang      add det dispose for Com_GetConfigurationId function.
 *                                         mark:SW201434
 *  V1.0.28     20140918  Song.Wang      add det dispose for Com_GetStatus function.
 *                                         mark:SW201435
 *  V1.0.29     20140918  Song.Wang      modify det bug for Com_ReceiveShadowSignal function.
 *                                                   when the parameter ptr is null, det dose not report error.
 *                                         mark:SW201436
 *  V1.0.30     20140918  Song.Wang      forced conversion return of Com_IpduHandleInSendSignal
 *                                                    function to void type.
 *                                         mark:SW201437
 *  V1.0.31     20140918  Song.Wang      forced conversion return of Com_IpduHandleInSendSignalGrp
 *                                                    function to void type.
 *                                         mark:SW201438
 *  V1.0.32     20140918  Song.Wang      merge two static variables(signalMapId, signalGrpMapId) to
 *                                                   one variable(rxMapId).
 *                                         mark:SW201439
 *  V1.0.33     20140918  Song.Wang      add little-end uint8N group signal shadow update disposing
 *                                                   when router signal group.
 *                                         mark:SW201440
 *  V1.0.34     20140919  Song.Wang      add need gateway runtime flag set in Com_RxIndication and
 *                                                   Com_MainFunctionRx.
 *                                         mark:SW201441
 *  V1.0.35     20140919  Song.Wang      add implementation of function Com_TriggerTransmit.
 *                                         mark:SW201442
 *  V1.0.36     20140919  Song.Wang      add implementation of function Com_TriggerIPDUSend.
 *                                         mark:SW201443
 *  V1.0.37     20140919  Song.Wang      add det error return value(0xffffffff) of function Com_GetConfigurationId.
 *                                         mark:SW201444
 *  V1.0.38     20140919  Song.Wang      change Com_GwRxIPduIdPB to COM_CFG_GWRXIPDUID for PB varient compiling.
 *                                         mark:SW201445
 *  V1.0.39     20140919  Song.Wang      add i-pdu-call invoke before transmit in Com_TriggerIPDUSend.
 *                                         mark:SW201446
 *  V1.0.40     20140919  Song.Wang      when MDT did not timeout, then  COM_RT_TXIPDUFLAG_DELAY_MASK
 *                                                   flag will be set in Com_GetConfigurationId.
 *                                         mark:SW201447
 *  V1.0.41     20140923  Song.Wang      change Com_UpdateShadowSignalInternal gateway
 *                                                   parameters' name and using way.
 *                                         mark:SW201448
 *  V1.0.42     20140923  Song.Wang      in Com_UpdateShadowSignalInternal with gateway, the current
 *                                                   calculation algorithm uint8N size will be one less, so the for loop
 *                                                   should change from < to <=.
 *                                         mark:SW201449
 *  V1.0.43     20140923  Song.Wang      change the type of static variable signalSize from uint8 to uint16 to
 *                                                   avoid forced conversion.
 *                                         mark:SW201450
 *  V1.0.44     20140923  Song.Wang      discard the using of macro function Com_Update8NSignalBuff
 *                                                   in function Com_UpdateGrpSignalValue.
 *                                         mark:SW201451
 *  V1.0.45     20140923  Song.Wang      correct spelling error.
 *                                         mark:SW201452
 *  V1.0.46     20140923  Song.Wang      change for loop calculation algorithm from tx to rx.
 *                                         mark:SW201453
 *  V1.0.47     20140923  Song.Wang      change != to ==.
 *                                         mark:SW201454
 *  V1.0.48     20140923  Song.Wang      COM_CFG_DEST_ID macro parameter should changed from
 *                                                   signalMapId to destObjId.
 *                                         mark:SW201455
 *  V1.0.49     20140924 Dongliang.Chen  Add: Macro point to Gw RxGrpSig Map to several TxGrpSigs.
 *                                         mark: DL201438
 *  V1.0.50     20140924  Song.Wang      in Com_GwySignalGrpUpdateShadowBuff, destination group signal
 *                                                   id finding use COM_CFG_GWRXGSMAPTXGSIDARRAY_START, 
 *                                                   COM_CFG_GWRXGSMAPTXGSIDARRAY_STOP,
 *                                                   COM_CFG_GWRXGRPSIGMAPTO_TXGRPSIGID three macros to 
 *                                                   implementation.
 *                                         mark:SW201456
 *  V1.0.51     20140926  Song.Wang      under rx deffer, gateway router flag should not set in Com_RxIndication.
 *                                         mark:SW201457
 *  V1.0.52     20140928 Dongliang.Chen  Modify: Com_TxSignalTMSHandle, Com_TxSignalGroupTMSHandle, Com_DestDescripTMSHandle
 *                                              return value from Signal/SignalGroup/DestinationDescription TMC Chagned or not
 *                                              to TxIPdu TMS Changed or not.
 *                                      mark: DL201439
 *  V1.0.53     20141010 Dongliang.Chen  Delete: Repeat COM_CFG_TXIPDU_ID.
 *                                      mark: DL201440
 *  V1.0.54     20141014  Song.Wang      change the functions Com_IpduHandleInSendSignal  and
 *                                                   Com_IpduHandleInSendSignalGrp to no return function. 
 *                                         mark:SW201458
 *  V1.0.55     20141024 Dongliang.Chen  Add: Com_MainFunctionRx, Add clear COM_RT_RXIPDUFLAG_DEFERR_MASK after deferred unpack
 *                                      mark: DL201441
 *  V1.0.56     20141027 Dongliang.Chen  Add: Com_TxSignalInitTMC, Com_TxGroupSignalInitTMC, Com_DestDescripInitTMC, three array.
 *                                      Modify: Com_TxSignalGroupInitTMCCntr to PB_CFG.
 *                                      mark: DL201442
 *  V1.0.57     20141028  Song.Wang     optimize the code for execution efficiency by changing macro to variables.
 *                                         mark:SW201459
 *  V1.0.58     20141029  Song.Wang     optimize the code for execution efficiency by reduce operators.
 *                                         mark:SW201460
 *  V1.0.59     20141030  Dongliang.Chen optimize: Add macro point to PB_Parameter_Array.
 *                                      mark: DL201443
 *  V1.0.60     20141031  Dongliang.Chen Add: COM_CONST_DESTDESCRIPTMCSRT_NUM Macro because this is PB_Parameter.
 *                                      mark: DL201444
 *  V1.0.61     20141103  Dongliang.Chen Rename:COM_RT_TXIPDUFLAG_CONF_MASK -> COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK
 *  V1.0.62     20141029  Song.Wang     modify bug for lack of '0x7fff&'.
 *                                         mark:SW201461
 *  V1.0.63     20141029  Song.Wang     optimize the code for reducing rom and ram use in Com_SendSignal.
 *                                         mark:SW201462
 *  V1.0.64     20141124  Song.Wang     optimize the code for reducing rom and ram all.
 *                                         mark:SW201463
 *  V1.0.65     20141126  Song.Wang     modify review items for optimizing.
 *                                       
 *  V1.0.66     20141127  Song.Wang     modify QAC bugs for optimizing.
 *                                      
 *  V1.0.67     20141127  Song.Wang     add source code notes for gateway related function.
 *                                        
 *
 *
 * These MISRA-C Rules not obeyed
 *
 * MISRA-C:2004 Rule Redundant,
 * Msg(3:0862) This #include ".../header/Com_MemMap.h" directive is redundant.
 * Reason: There include many "Com_MemMap.h" to abstract complier.
 *
 * MISRA-C:2004 Rule Redundant,
 * Msg(3:3206) The parameter 'XXX' is not used in this function.
 * Reason: There are some functions or parameters not used in this code.
 *
 * MISRA-C:2004 Rule 8.10,
 * Msg(4:1505) The function 'XXX' is only referenced in the translation unit where it is defined.
 * Reason: Some external functions is called by other functions in this code.
 *
 * MISRA-C:2004 Rule 11.4,
 * Msg(4:0316) [I] Cast from a pointer to void to a pointer to object type.
 * Reason: Cast void*.
 *
 * MISRA-C:2004 Rule 11.5,
 * Msg(4:0311) Dangerous pointer cast results in loss of const qualification.
 * Reason: Cast void*.
 *
 * MISRA-C:2004 Rule 12.4,
 * Msg(4:3415) Right hand operand of '&&' or '||' is an expression with possible side effects.
 * Reason: Called IPdu_Callout in "if" judgemental code.
 *
 * MISRA-C:2004 Rule 12.7,
 * Msg(4:4130) Bitwise operations on signed data will give implementation defined results.
 * Reason: QAC considers "~" is negative.
 *
 * MISRA-C:2004 Rule 14.1,
 * Msg(4:1503) The function 'Com_Init' is defined but is not used within this project.
 * Reason: These Function is not called in Main().
 *
 * MISRA-C:2004 Rule 17.4,
 * Msg(4:0489) The integer value 1 is being added or subtracted from a pointer.
 * Reason: Pointer is added by 1 when unpacking or packing value.
 *
 * MISRA-C:2004 Rule 17.4,
 * Msg(4:0491) Array subscripting applied to an object of pointer type.
 * Reason: Operate the object of pointer directly.
 *
 * MISRA-C:2004 Rule 17.4,
 * Msg(4:0492) Array subscripting applied to a function parameter declared as a pointer.
 * Reason: Operate the object of pointer directly.
 *
 * MISRA-C:2004 Rule 19.4,
 * Msg(4:3412) Macro defines an unrecognized code-fragment.
 * Reason: There is "if...else..." in Macro.
 *
 * MISRA-C:2004 Rule 19.4,
 * Msg(4:3458) Macro defines a braced code statement block.
 * Reason: There is local variable statement in Macro.
 *
 * MISRA-C:2004 Rule 19.5,
 * Msg(4:0842) Using #define or #undef inside a function.
 * Reason: In function, used #define & #undef to make code easier understood.
 *
 * MISRA-C:2004 Rule 19.6,
 * Msg(4:0841) Using #define or #undef inside a function.
 * Reason: In function, used #define & #undef to make code easier understood.
 *
 * MISRA-C:2004 Rule 19.7,
 * Msg(4:3453) A function could probably be used instead of this function-like macro.
 * Reason: Use these macro to fit PC/LT/PB Variant.
 *
 * MISRA-C:2004 Rule 19.12,
 * Msg(4:0881) Using multiple ## operators in the same macro definition.
 * Reason: Use ##.
 *
 * MISRA-C:2004 Rule 19.13,
 * Msg(4:0342) Using the glue operator '##'.
 * Reason: Use ##.
 *
 */
/*============================================================================*/

/*=======[V E R S I O N  I N F O R M A T I O N]===============================*/

#define COM_C_AR_MAJOR_VERSION  3U
#define COM_C_AR_MINOR_VERSION  2U
#define COM_C_AR_PATCH_VERSION  0U
#define COM_C_SW_MAJOR_VERSION  1U
#define COM_C_SW_MINOR_VERSION  0U
#define COM_C_SW_PATCH_VERSION  67U


/*=======[I N C L U D E S]====================================================*/
#include "Com.h"
#include "Com_Cbk.h"
#include "SchM_Com.h"

#if(STD_ON == COM_DEV_ERROR_DETECT)
#include "Det.h"
#endif

#include "PduR_Com.h"




/*=======[V E R S I O N  C H E C K]===========================================*/
#if (COM_C_AR_MAJOR_VERSION != COM_H_AR_MAJOR_VERSION)
  #error "Com.c : Mismatch in Specification Major Version"
#endif
#if (COM_C_AR_MINOR_VERSION != COM_H_AR_MINOR_VERSION)
  #error "Com.c : Mismatch in Specification Major Version"
#endif
#if (COM_C_AR_PATCH_VERSION != COM_H_AR_PATCH_VERSION)
  #error "Com.c : Mismatch in Specification Major Version"
#endif
#if (COM_C_SW_MAJOR_VERSION != COM_H_SW_MAJOR_VERSION)
  #error "Com.c : Mismatch in Specification Major Version"
#endif
#if (COM_C_SW_MINOR_VERSION != COM_H_SW_MINOR_VERSION)
  #error "Com.c : Mismatch in Specification Major Version"
#endif

#if STD_ON == COM_DEV_ERROR_DETECT
#if( 2u != DET_H_AR_MAJOR_VERSION)
    #error "Com.c : Mismatch in Specification Major Version"
#endif

#if( 2u != DET_H_AR_MINOR_VERSION)
    #error "Com.c : Mismatch in Specification Minor Version"
#endif
#endif

#if( 3u != COM_CBK_H_AR_MAJOR_VERSION)
    #error "COM.c : Mismatch in Specification Major Version"
#endif

#if( 2u != COM_CBK_H_AR_MINOR_VERSION)
    #error "COM.c : Mismatch in Specification Minor Version"
#endif


/*=======[M A C R O S]========================================================*/
/* Com_IPduGroupPBType->comIPduGroupFlag */
#define COM_IPDUGROUPDIRECT_MASK         ((uint8)0x01U)    /* 0Bit, Tx(1)/Rx(0) Direction */
#define COM_IPDUGROUPDEGREE_MASK         ((uint8)0x02U)    /* 1Bit, Sub(1) / Parent(0) IPduGroup */

/* Com_RxIPduPBType->comIPduFlag */
#define COM_RXIPDU_SINGALPROCESS_MASK    ((uint8)0x01U)  /* 0bit, IPduSignalProcess, Deferred(1)/Immediate(0) */
#define COM_RXIPDU_TYPE_MASK             ((uint8)0x02U)  /* 1bit, IPduType, Normal(0)/Tp(1) */
#define COM_RXIPDU_NEEDCOPY_MASK         ((uint8)0x04U)  /* 2bit, RxIPduCopy(1)or not(0) Deffer or gateway need copy */
/* DL201433 */
#define COM_RXIPDU_GW_MASK               ((uint8)0x08U)  /* 3bit, this IPdu have GeatwayMap(1) or not */

/* Com_TxIPduPBType->comIPduFlag */
#define COM_TXIPDU_SINGALPROCESS_MASK    ((uint8)0x01U)  /* 0bit, IPduSignalProcess, Deferred(1)/Immediate(0) */
#define COM_TXIPDU_TYPE_MASK             ((uint8)0x02U)  /* 1bit, IPduType, Normal(0)/Tp(1) */

/* Com_TxSignalPBType->comSignalPBFlag */
#define COM_PBTXSIGNALTYPE_MASK            ((uint8)0xF0U)   /* bit7-bit4, SignalType */
#define COM_TXSIGNAL_TYPE_BOOLEAN          ((uint8)0x10U)
#define COM_TXSIGNAL_TYPE_SINT8            ((uint8)0x20U)
#define COM_TXSIGNAL_TYPE_SINT16           ((uint8)0x30U)
#define COM_TXSIGNAL_TYPE_SINT32           ((uint8)0x40U)
#define COM_TXSIGNAL_TYPE_UINT8            ((uint8)0x50U)
#define COM_TXSIGNAL_TYPE_UINT16           ((uint8)0x60U)
#define COM_TXSIGNAL_TYPE_UINT32           ((uint8)0x70U)
#define COM_TXSINGAL_TYPE_UNIT8_N          ((uint8)0x80U)

#define COM_PBTXSIGENDIANESS_MASK          ((uint8)0x0CU)    /* bit3-bit2, SignalEndianess */
#define COM_TXSIGNAL_ENDIANESS_BIG         ((uint8)0x04U)
#define COM_TXSIGNAL_ENDIANESS_LITTLE      ((uint8)0x08U)
#define COM_TXSIGNAL_ENDIANESS_OPAQUE      ((uint8)0x0CU)

#define COM_PBTXPROP_MASK                  ((uint8)0x03U)   /* bit1-bit0, SignalTxProp */
#define COM_TX_PROP_PENDING                ((uint8)0x01U)
#define COM_TX_PROP_TRIGGERED              ((uint8)0x02U)
#define COM_TX_PROP_TRIGGERED_ON_CHANGE    ((uint8)0x03U)

#define COM_PBTXGRPSIGWITHPROP_MASK        ((uint8)0x04U)    /* bit2, the GroupSignal of this SignalGroup has transfer property(1) or not(0) */

/* Com_RxSignalPBType->comSignalPBFlag */
#define COM_PBRXSIGNALTYPE_MASK            ((uint8)0xF0U)    /* bit7-bit4, SignalType */
#define COM_RXSIGNAL_TYPE_BOOLEAN          ((uint8)0x10U)
#define COM_RXSIGNAL_TYPE_SINT8            ((uint8)0x20U)
#define COM_RXSIGNAL_TYPE_SINT16           ((uint8)0x30U)
#define COM_RXSIGNAL_TYPE_SINT32           ((uint8)0x40U)
#define COM_RXSIGNAL_TYPE_UINT8            ((uint8)0x50U)
#define COM_RXSIGNAL_TYPE_UINT16           ((uint8)0x60U)
#define COM_RXSIGNAL_TYPE_UINT32           ((uint8)0x70U)
#define COM_RXSINGAL_TYPE_UNIT8_N          ((uint8)0x80U)

#define COM_PBRXSIGENDIANESS_MASK          ((uint8)0x0CU)    /* bit3-bit2, SignalEndianess */
#define COM_RXSIGNAL_ENDIANESS_BIG         ((uint8)0x04U)
#define COM_RXSIGNAL_ENDIANESS_LITTLE      ((uint8)0x08U)
#define COM_RXSIGNAL_ENDIANESS_OPAQUE      ((uint8)0x0CU)


/* Com_RxSignalLTType->comSignalLTFlag */
#define COM_DATAINVACTION_MASK            ((uint8)0x06U)    /* bit2-bit1, DataIncalidationAction */
#define COM_DATA_INVALIDACTION_NOTIFY     ((uint8)0x02U)
#define COM_DATA_INVALIDACTION_REPLACE    ((uint8)0x04U)
#define COM_DATA_INVALIDACTION_NOHANDLE   ((uint8)0x06U)

#define COM_RXDMTOUT_MASK                 ((uint8)0x01U)    /* bit0, RxTOutAction, NONE(0)/Replace(1)*/
#define COM_RXDMTOUT_REPLACE              ((uint8)0x01U)

/* DL201419 */
#if (STD_ON == COM_FILTER_ENABLE)
#define COM_RXSIGNAL_NEEDOLDBUFF_MASK     ((uint8)0x08U)    /* bit3, RxSignalNeedOldBuffer(1)(This Signal_Filter=F_MaskedNewDiffersMaskedOld && RxSignalDM!=0) or not(0) */
#endif
/* DL201419 */

/* Com_TxIPduRTimeFlag */
#define COM_RT_TXIPDUFLAG_ACTIVE_MASK                ((uint8)0x01U)    /* 0bit, This IPdu is Active(1) or not(0). */
#define COM_RT_TXIPDUFLAG_DEFERR_MASK                ((uint8)0x02U)    /* 1bit, Deferred ACK & Timer of IPdu(1) */
#define COM_RT_TXIPDUFLAG_DELAY_MASK                 ((uint8)0x04U)    /* 2bit, Delayed Tx(1) */
/* DL201413 */
/* 3th bit, first trans-delay in send API when MDT didn't 
   timeout and under Mix or DN or Period TM. Delay(1) or not(0) */
#define COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK            ((uint8)0x08U)
/* DL201413 */
#define COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK                  ((uint8)0x10U)    /* 4bit, this TxIPdu is Confirm(0) or not(1) */

/* DL201436 */
#define COM_RT_TXIPDUFLAG_GWNEEDTX_MASK              ((uint8)0x20U)    /* 5bit, this TxIPdu need transmit(1) in MainFunctionRouteSignals */
/* DL201436 */

/* DL201413, DL201417, DL201419 */
#if (STD_ON == COM_FILTER_ENABLE)
#define COM_RT_TXIPDUFLAG_TMSCHAINMDT                ((uint8)0x40U)    /* 6bit, this TxIPdu TMS Changed in MDT(1) */
#endif
/* DL201413, DL201417, DL201419 */

/* DL201410 */
#define COM_RT_TXIPDUFLAG_DELAYPENDTX                ((uint8)0x80U)    /* 7bit, Send_API send Pending Signal/SignalGroup when TMS Changes to Mixed */
/* DL201410 */

/* COM_RxIPduRTimeFlag */
#define COM_RT_RXIPDUFLAG_ACTIVE_MASK                ((uint8)0x01U)    /* 0bit, This IPdu is Active(1) or not(0). */
#define COM_RT_RXIPDUFLAG_DEFERR_MASK                ((uint8)0x02U)    /* 1bit, Deferred Unpack(1) or not(0) */
#define COM_RT_RXIPDUFLAG_ENABLEDM_MASK              ((uint8)0x04U)    /* 2bit, RxIPduDM Enable(1) or Disable(0) */
/* DL201420 */
#if (STD_ON == COM_GATEWAY_ENABLE)
#define COM_RT_RXIPDUFLAG_NEEDGW_MASK                ((uint8)0x08U)    /* 3bit, This RxIPdu need GW(1) or not(0) */
#endif
/* DL201420 */

/* COM_TxSignalGroupRTimeFlag */
#define COM_RT_TXSIGGRP_NEEDNTIMESTX                 ((uint8)0x01U)    /* 0bit, SignalGroup need N-Times Transmit(1) or not(0) */
#define COM_RT_TXSIGGRP_IMMIEDIATX                   ((uint8)0x02U)    /* API_SendSignalGroup send this SignalGroup(1) or not(0) */

/* DL201434 */
/* Com_Signal/GroupSignal/Description Spans how many bytes in IPdu */
#define COM_RT_SIGNALSPAN_0IPDUBYTE                  ((uint8)0x00U)    /* Signal Spans 0 Byte in IPdu, The whole signal is in one byte of IPdu */
#define COM_RT_SIGNALSPAN_1IPDUBYTE                  ((uint8)0x01U)    /* Signal Spans 1 Byte in IPdu, The whole signal is in two bytes of IPdu */
#define COM_RT_SIGNALSPAN_2IPDUBYTE                  ((uint8)0x02U)    /* Signal Spans 2 Byte in IPdu, The whole signal is in three bytes of IPdu */
#define COM_RT_SIGNALSPAN_3IPDUBYTE                  ((uint8)0x03U)    /* Signal Spans 3 Byte in IPdu, The whole signal is in four bytes of IPdu */
#define COM_RT_SIGNALSPAN_4IPDUBYTE                  ((uint8)0x04U)    /* Signal Spans 4 Byte in IPdu, The whole signal is in five bytes of IPdu */
/* DL201434 */



#if (COM_VARIANT_PB == COM_VARIANT_CFG)
#define COM_CONST_RXIPDU_NUM                        (Com_RxIPduNum)
#define COM_CONST_TXIPDU_NUM                        (Com_TxIPduNum)
#define COM_CONST_TXSIGNALGROUP_NUM                 (Com_TxSignalGroupNum)
#define COM_CONST_RXIPDUBUFF_SIZE                   (Com_ConfigStd->comRxIPduSize)
#define COM_CONST_TXIPDUBUFF_SIZE                   (Com_ConfigStd->comTxIPduSize)
#define COM_CONST_SIGNALBOOLBUFF_SIZE               (Com_ConfigStd->comSignalBoolSize)
#define COM_CONST_SIGNAL8BITBUFF_SIZE                    (Com_ConfigStd->comSignal8BitSize)
#define COM_CONST_SIGNAL16BITBUFF_SIZE                   (Com_ConfigStd->comSignal16BitSize)
#define COM_CONST_SIGNAL32BITBUFF_SIZE                   (Com_ConfigStd->comSignal32BitSize)
#define COM_CONST_RXGRPSIGBOOLBUFF_SIZE                  (Com_ConfigStd->comRxGroupSignalBoolSize)
#define COM_CONST_RXGRPSIG8BITBUFF_SIZE                  (Com_ConfigStd->comRxGroupSignal8BitSize)
#define COM_CONST_RXGRPSIG16BITBUFF_SIZE                 (Com_ConfigStd->comRxGroupSignal16BitSize)
#define COM_CONST_RXGRPSIG32BITBUFF_SIZE                 (Com_ConfigStd->comRxGroupSignal32BitSize)

#define COM_CFG_SIGNALBOOL_INITVALUE(SignalValueIndex)        (Com_ConfigStd->comBoolInitValueSignal[SignalValueIndex])
#define COM_CFG_SIGNAL8BIT_INITVALUE(SignalValueIndex)        (Com_ConfigStd->com8BitInitValueSignal[SignalValueIndex])
#define COM_CFG_SIGNAL16BIT_INITVALUE(SignalValueIndex)       (Com_ConfigStd->com16BitInitValueSignal[SignalValueIndex])
#define COM_CFG_SIGNAL32BIT_INITVALUE(SignalValueIndex)       (Com_ConfigStd->com32BitInitValueSignal[SignalValueIndex])

#define COM_CFG_RXGRPSIGBOOL_INITVALUE(GrpSigValueIndex)      (Com_ConfigStd->comBoolRxGroupSignalInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG8BIT_INITVALUE(GrpSigValueIndex)      (Com_ConfigStd->com8BitRxGroupSignalInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG16BIT_INITVALUE(GrpSigValueIndex)     (Com_ConfigStd->com16BitRxGroupSignalInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG32BIT_INITVALUE(GrpSigValueIndex)     (Com_ConfigStd->com32BitRxGroupSignalInitValue[GrpSigValueIndex])

#define COM_CFG_SIGNALBOOL_INVALIDVALUE(SignalValueIndex)         (Com_ConfigStd->comBoolInvValue[SignalValueIndex])
#define COM_CFG_SIGNAL8BIT_INVALIDVALUE(SignalValueIndex)         (Com_ConfigStd->com8BitInvValue[SignalValueIndex])
#define COM_CFG_SIGNAL16BIT_INVALIDVALUE(SignalValueIndex)        (Com_ConfigStd->com16BitInvValue[SignalValueIndex])
#define COM_CFG_SIGNAL32BIT_INVALIDVALUE(SignalValueIndex)        (Com_ConfigStd->com32BitInvValue[SignalValueIndex])

#define COM_CFG_RXIPDU_INITVALUE(ValueIndex)                (Com_ConfigStd->comRxIPduInitValue[ValueIndex])
#define COM_CFG_TXIPDU_INITVALUE(ValueIndex)                (Com_ConfigStd->comTxIPduInitValue[ValueIndex])

#define COM_CONST_CONFIG_ID                                   (Com_ConfigStd->comConfigurationId)


#define COM_CFG_IPDUGROUP_FLAG(IPduGroupId)               (Com_ConfigStd->comIPduGroupPB[IPduGroupId].comIPduGroupFlag)
#define COM_CFG_SUBIPDUGROUPID_START(ParentIPduGroup)     (Com_ConfigStd->comIPduGroupPB[ParentIPduGroup].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_SUBIPDUGROUPID_STOP(ParentIPduGroup)      (Com_ConfigStd->comIPduGroupPB[ParentIPduGroup].comIPduOrGroupStop)

#define COM_CFG_RXIPDU_INDEX_START(IPduGroupId)    (Com_ConfigStd->comIPduGroupPB[IPduGroupId].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_RXIPDU_INDEX_STOP(IPduGroupId)     (Com_ConfigStd->comIPduGroupPB[IPduGroupId].comIPduOrGroupStop)
#define COM_CFG_RXIPDU_ID(RxIPduIndex)             (Com_ConfigStd->comRxIPduIdMap[RxIPduIndex])

#define COM_CFG_TXIPDU_INDEX_START(IPduGroupId)    (Com_ConfigStd->comIPduGroupPB[IPduGroupId].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_TXIPDU_INDEX_STOP(IPduGroupId)     (Com_ConfigStd->comIPduGroupPB[IPduGroupId].comIPduOrGroupStop)
#define COM_CFG_TXIPDU_ID(TxIPduIndex)             (Com_ConfigStd->comTxIPduIdMap[TxIPduIndex])

#define COM_CFG_RXSIGNAL_INDEX_START(RxIPduId)      (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalIndexStart)
/* DL201425 */
#define COM_CFG_RXSIGNAL_INDEX_STOP(RxIPduId)       (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalIndexStop)
#define COM_CFG_RXSIGNAL_ID(RxSignalIndex)          (Com_ConfigStd->comRxSignalIdMap[RxSignalIndex])

#define COM_CFG_TXSIGNAL_INDEX_START(TxIPduId)      (Com_ConfigStd->comTxIPduPB[TxIPduId].comSignalIndexStart)
/* DL201425 */
#define COM_CFG_TXSIGNAL_INDEX_STOP(TxIPduId)       (Com_ConfigStd->comTxIPduPB[TxIPduId].comSignalIndexStop)
#define COM_CFG_TXSIGNAL_ID(TxSignalIndex)          (Com_ConfigStd->comTxSignalIdMap[TxSignalIndex])

#define COM_CFG_RXSIGNALGROUP_INDEX_START(RxIPduId)      (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalGroupIndexStart)
/* DL201425 */
#define COM_CFG_RXSIGNALGROUP_INDEX_STOP(RxIPduId)       (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalGroupIndexStop)
#define COM_CFG_RXSIGNALGROUP_ID(RxSignalGroupIndex)     (Com_ConfigStd->comRxSignalGroupIdMap[RxSignalGroupIndex])

#define COM_CFG_TXSIGNALGROUP_INDEX_START(TxIPduId)      (Com_ConfigStd->comTxIPduPB[TxIPduId].comSignalGroupIndexStart)
/* DL201425 */
#define COM_CFG_TXSIGNALGROUP_INDEX_STOP(TxIPduId)       (Com_ConfigStd->comTxIPduPB[TxIPduId].comSignalGroupIndexStop)
#define COM_CFG_TXSIGNALGROUP_ID(TxSignalGroupIndex)     (Com_ConfigStd->comTxSignalGroupIdMap[TxSignalGroupIndex])

#define COM_CFG_TXMODE_TRUE(TxIPduId)               (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeTrueIndex].comTxMode)
#define COM_CFG_TXMODE_TRUE_N(TxIPduId)             (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_TRUE_NTCNTR(TxIPduId)        (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_TRUE_OFFSETCNTR(TxIPduId)        (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_TRUE_PERIODCNTR(TxIPduId)        (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeTimePeriod)

#define COM_CFG_RXIPDU_FLAG(RxIPduId)               (Com_ConfigStd->comRxIPduPB[RxIPduId].comIPduFlag)
#define COM_CFG_RXIPDU_SIZE(RxIPduId)               (Com_ConfigStd->comRxIPduPB[RxIPduId].comIPduSize)
#define COM_CFG_RXIPDU_FIRSTDM(RxIPduId)            (Com_ConfigStd->comRxIPduPB[RxIPduId].comIPduFirstDM)
#define COM_CFG_RXIPDU_DM(RxIPduId)                 (Com_ConfigStd->comRxIPduPB[RxIPduId].comIPduDM)
#define COM_CFG_RXIPDU_BUFFINDEX(RxIPduId)          (Com_ConfigStd->comRxIPduPB[RxIPduId].comRxIPduBufIndex)
#define COM_CFG_RXIPDU_IPDUGROUPMASK_L(RxIPduId)    (Com_ConfigStd->comRxIPduPB[RxIPduId].comIPduGroupMaskL)
#define COM_CFG_RXIPDU_IPDUGROUPMASK_H(RxIPduId)    (Com_ConfigStd->comRxIPduPB[RxIPduId].comIPduGroupMaskH)

#define COM_CFG_TXIPDU_FLAG(TxIPduId)               (Com_ConfigStd->comTxIPduPB[TxIPduId].comIPduFlag)
#define COM_CFG_LOWLAYER_PDUID(TxIPduId)            (Com_ConfigStd->comTxIPduPB[TxIPduId].comLowLayerPduId)
#define COM_CFG_TXIPDU_SIZE(TxIPduId)               (Com_ConfigStd->comTxIPduPB[TxIPduId].comIPduSize)
#define COM_CFG_TXIPDU_BUFFINDEX(TxIPduId)          (Com_ConfigStd->comTxIPduPB[TxIPduId].comTxIPduBufIndex)
#define COM_CFG_TXIPDU_TMSCNTRINIT(TxIPduId)        (Com_ConfigStd->comTxIPduPB[TxIPduId].comTxIPduTMSCntrInitVal)
#define COM_CFG_TXIPDU_MDT(TxIPduId)                (Com_ConfigStd->comTxIPduPB[TxIPduId].comIPduMDT)
#define COM_CFG_TXIPDU_DM(TxIPduId)                 (Com_ConfigStd->comTxIPduPB[TxIPduId].comIPduDM)
#define COM_CFG_TXIPDU_IPDUGROUPMASK_L(TxIPduId)    (Com_ConfigStd->comTxIPduPB[TxIPduId].comIPduGroupMaskL)
#define COM_CFG_TXIPDU_IPDUGROUPMASK_H(TxIPduId)    (Com_ConfigStd->comTxIPduPB[TxIPduId].comIPduGroupMaskH)

#define COM_CFG_RXSIGNAL_PBFLAG(RxSignalId)         (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalPBFlag)
#define COM_CFG_RXSIGNAL_ENDBYTE(RxSignalId)        (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalEndByte)
/* DL201434 */
#define COM_CFG_RXSIGNAL_LSBPOS(RxSignalId)            (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalLSBPos)
#define COM_CFG_RXSIGNAL_MSBPOS(RxSignalId)            (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalMSBPos)
/* DL201434 */
#define COM_CFG_RXSIGNAL_INVALIDVALUE_INDEX(RxSignalId)   (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalInvValueIndex)
#define COM_CFG_RXSIGNAL_VALUEINDEX(RxSignalId)     (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalBufIndex)
#define COM_CFG_RXSIGNAL_IPDUIDREF(RxSignalId)      (Com_ConfigStd->comRxSignalPB[RxSignalId].comIPduRefIndex)

#define COM_CFG_TXSIGNAL_PBFLAG(TxSignalId)         (Com_ConfigStd->comTxSignalPB[TxSignalId].comSignalPBFlag)
/* DL201434 */
#define COM_CFG_TXSIGNAL_LSBPOS(TxSignalId)            (Com_ConfigStd->comTxSignalPB[TxSignalId].comSignalLSBPos)
#define COM_CFG_TXSIGNAL_MSBPOS(TxSignalId)            (Com_ConfigStd->comTxSignalPB[TxSignalId].comSignalMSBPos)
/* DL201434 */
#define COM_CFG_TXSIGNAL_VALUEINDEX(TxSignalId)     (Com_ConfigStd->comTxSignalPB[TxSignalId].comSignalBufIndex)
#define COM_CFG_TXSIGNAL_INVALIDVALUE_INDEX(TxSignalId)   (Com_ConfigStd->comTxSignalPB[TxSignalId].comSignalnvValueIndex)
#define COM_CFG_TXSIGNAL_IPDUIDREF(TxSignalId)      (Com_ConfigStd->comTxSignalPB[TxSignalId].comIPduRefIndex)

#define COM_CFG_RXSIGNALGROUP_ENDBYTE(RxSignalGroupId)      (Com_ConfigStd->comRxSignalGroupPB[RxSignalGroupId].comSignalGroupEndByte)
#define COM_CFG_RXSIGNALGROUP_IPDUIDREF(RxSignalGroupId)    (Com_ConfigStd->comRxSignalGroupPB[RxSignalGroupId].comIPduRefIndex)

#define COM_CFG_TXSIGNALGROUP_PBFLAG(TxSignalGroupId)       (Com_ConfigStd->comTxSignalGroupPB[TxSignalGroupId].comSignalGroupPBFlag)
#define COM_CFG_TXSIGNALGROUP_IPDUIDREF(TxSignalGroupId)    (Com_ConfigStd->comTxSignalGroupPB[TxSignalGroupId].comIPduRefIndex)

#define COM_CFG_RXGRPSIG_PBFLAG(RxGroupSignalId)         (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGroupSignalPBFlag)
/* DL201434 */
#define COM_CFG_RXGRPSIG_LSBPOS(RxGroupSignalId)            (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGroupSignalLSBPos)
#define COM_CFG_RXGRPSIG_MSBPOS(RxGroupSignalId)            (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGroupSignalMSBPos)
/* DL201434 */
#define COM_CFG_RXGRPSIG_VALUEINDEX(RxGroupSignalId)     (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGroupSignalBufIndex)
#define COM_CFG_RXGRPSIG_INVLDVALUE_INDEX(RxGroupSignalId)   (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGroupSignalInvValueIndex)

#define COM_CFG_TXGRPSIG_PBFLAG(TxGroupSignalId)           (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId].comGroupSignalPBFlag)
/* DL201434 */
#define COM_CFG_TXGRPSIG_LSBPOS(TxGroupSignalId)              (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId].comGroupSignalLSBPos)
#define COM_CFG_TXGRPSIG_MSBPOS(TxGroupSignalId)              (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId].comGroupSignalMSBPos)
/* DL201434 */
#define COM_CFG_TXGRPSIG_VALUEINDEX(TxGroupSignalId)       (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId].comGroupSignalBufIndex)
#define COM_CFG_TXGRPSIG_INVLDVALUE_INDEX(TxGroupSignalId)     (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId].comGroupSignalInvValueIndex)


#if (STD_ON == COM_FILTER_ENABLE)
#define COM_CONST_RXSIGNALONEEVERYN_NUM              (Com_RxSignalOneEveryNNum)
#define COM_CONST_TXSIGNALTMCRST_NUM                 (Com_TxSignalTMCRSTNum)
#define COM_CONST_TXSIGNALONEEVERYN_NUM              (Com_TxSignalOneEveryNNum)
#define COM_CONST_TXGRPSIGONEEVERYN_NUM              (Com_TxGroupSignalOneEveryNNum)
#define COM_CONST_TXSIGNALGROUPTMC_NUM               (Com_TxSignalGroupTMCNum)
#define COM_COMST_TXGROUPSIGNALTMCSRT_NUM            (Com_TxGroupSignalTMCRSTNum)
#define COM_CONST_RXSIGNALNOBBOOLSIZE                (Com_ConfigStd->comRxSignalNOBBoolSize)
#define COM_CONST_RXSIGNALNOB8BITSIZE                (Com_ConfigStd->comRxSignalNOB8BitSize)
#define COM_CONST_RXSIGNALNOB16BITSIZE               (Com_ConfigStd->comRxSignalNOB16BitSize)
#define COM_CONST_RXSIGNALNOB32BITSIZE               (Com_ConfigStd->comRxSignalNOB32BitSize)


#define COM_CFG_RXSIGNOBBOOL_INITVALUE(SignalValueIndex)         (Com_ConfigStd->comBoolInitValueRxNOBSignal[SignalValueIndex])
#define COM_CFG_RXSIGNOB8BIT_INITVALUE(SignalValueIndex)         (Com_ConfigStd->com8BitInitValueRxNOBSignal[SignalValueIndex])
#define COM_CFG_RXSIGNOB16BIT_INITVALUE(SignalValueIndex)        (Com_ConfigStd->com16BitInitValueRxNOBSignal[SignalValueIndex])
#define COM_CFG_RXSIGNOB32BIT_INITVALUE(SignalValueIndex)        (Com_ConfigStd->com32BitInitValueRxNOBSignal[SignalValueIndex])

#define COM_CFG_RXSIGNAL_FILTERFNCINDEX(RxSignalId)      (Com_ConfigStd->comRxSignalPB[RxSignalId].comFilterFuncIndex)
#define COM_CFG_TXSIGNAL_FILTERFNCINDEX(TxSignalId)      (Com_ConfigStd->comTxSignalPB[TxSignalId].comFilterFuncIndex)
#define COM_CFG_TXGRPSIG_FILTERFNCINDEX(TxGroupSignalId) (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId].comFilterFuncIndex)

#define COM_CFG_TXMODE_FALSE(TxIPduId)              (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeFalseIndex].comTxMode)
#define COM_CFG_TXMODE_FALSE_N(TxIPduId)            (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_FALSE_NTCNTR(TxIPduId)      (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_FALSE_OFFSETCNTR(TxIPduId)       (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_FALSE_PERIODCNTR(TxIPduId)       (Com_ConfigStd->comTxMode[Com_ConfigStd->comTxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeTimePeriod)

/* DL201442 */
#define COM_CFG_TXSIGNAL_INITTMC(TXSignalTMCIndex)    (Com_ConfigStd->comTxSignalInitTMC[TXSignalTMCIndex])
#define COM_CFG_TXGRPSIG_INITTMC(TXGrpSigTMCIndex)    (Com_ConfigStd->comTxGroupSignalInitTMC[TXGrpSigTMCIndex])
#define COM_CFG_TXSIGGRP_INITTMC(TxSigGrpTMCIndex)    (Com_ConfigStd->comTxSignalGroupInitTMCCntr[TxSigGrpTMCIndex])
/* DL201442 */

#endif    /* end of STD_ON == COM_FILTER_ENABLE */


#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define COM_CONST_SIGNAL_DM_CNTRNUM                    (Com_ConfigStd->comSignalDMCntrSize)
#define COM_CONST_SIGGRP_DM_CNTRNUM               (Com_ConfigStd->comSignalGroupDMCntrSize)

#define COM_CFG_SIGNALID_FROMDMINDEX(SignalDMIndex)              (Com_ConfigStd->comRxUpdateSignalId[SignalDMIndex])
#define COM_CFG_SIGGRPID_FROMDMINDEX(SignalGroupDMIndex)    (Com_ConfigStd->comRxUpdateSignalGroupId[SignalGroupDMIndex])

#define COM_CFG_RXSIGNAL_UPDATEBITPOS(RxSignalId)               (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalUpdateBitPos)
#define COM_CFG_RXSIGNAL_DMINDEX(RxSignalId)                    (Com_ConfigStd->comRxSignalPB[RxSignalId].comSignalDMIndex)

#define COM_CFG_TXSIGNAL_UPDATEBITPOS(TxSignalId)               (Com_ConfigStd->comTxSignalPB[TxSignalId].comSignalUpdateBitPos)

#define COM_CFG_RXSIGGRP_UPDATEBITPOS(RxSignalGroupId)          (Com_ConfigStd->comRxSignalGroupPB[RxSignalGroupId].comUpdateBitPos)
#define COM_CFG_RXSIGGRP_DMINDEX(RxSignalGroupId)               (Com_ConfigStd->comRxSignalGroupPB[RxSignalGroupId].comSignalGroupDMIndex)

#define COM_CFG_TXSIGGRP_UPDATEBITPOS(TxSignalGroupId)          (Com_ConfigStd->comTxSignalGroupPB[TxSignalGroupId].comUpdateBitPos)
#endif    /* end of STD_ON == COM_UPDATEBIT_ENABLE */


#if (STD_ON == COM_GATEWAY_ENABLE)
/* DL201437 */
#define COM_CFG_GWRXIPDU_NUMBER                     (Com_ConfigStd->comGwRxIPduSize)
#define COM_CFG_GWTXIPDU_NUMBER                     (Com_ConfigStd->comGwTxIPduSize)
/* DL201437 */

/* DL201428 */
#define COM_CFG_GWRXIPDUID(RxIdArrayIndex)          (Com_ConfigStd->comGwRxIPduIdPB[RxIdArrayIndex])
#define COM_CFG_GWTXIPDUID(TxIdArrayIndex)          (Com_ConfigStd->comGwTxIPduIdPB[TxIdArrayIndex])

#define COM_CFG_RXSIGGWMAP_STARTINDEX(RxIPduId)     (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalGwMapStart)
/* DL201425 */
#define COM_CFG_RXSIGGWMAP_STOPINDEX(RxIPduId)      (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalGwMapStop)
#define COM_CFG_RXSIGGRPMAP_STARTINDEX(RxIPduId)    (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalGroupGwMapStart)
/* DL201425 */
#define COM_CFG_RXSIGGRPMAP_STOPINDEX(RxIPduId)     (Com_ConfigStd->comRxIPduPB[RxIPduId].comSignalGroupGwMapStop)

#define COM_CFG_DEST_ID(DestArrayIndex)             (Com_ConfigStd->comDestIdArrayPB[DestArrayIndex])

#define COM_CFG_GWSRCDESC_FLAG(GwSourceDescId)              (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcFlag)
#define COM_CFG_GWSRCDESC_SIZE(GwSourceDescId)              (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcSize)
#define COM_CFG_GWSRCDESC_ENDBYTE(GwSourceDescId)           (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcEndByte)
/* DL201434 */
#define COM_CFG_GWSRCDESC_LSBPOS(GwSourceDescId)               (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcLSBPos)
#define COM_CFG_GWSRCDESC_MSBPOS(GwSourceDescId)               (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcMSBPos)
/* DL201434 */
#define COM_CFG_GWSRCDESC_IPDUIDREF(GwSourceDescId)         (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcIPduRefIndex)

#define COM_CFG_GWDESTDESC_FLAG(GwDestDescId)               (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comGwDestFlag)
/* DL201434 */
#define COM_CFG_GWDESTDESC_LSBPOS(GwDestDescId)                (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comGwDestLSBPos)
#define COM_CFG_GWDESTDESC_MSBPOS(GwDestDescId)                (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comGwDestMSBPos)
/* DL201434 */
#define COM_CFG_GWDESTDESC_VALUEINDEX(GwDestDescId)               (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comGwDestBufIndex)
#define COM_CFG_GWDESTDESC_IPDUIDREF(GwDestDescId)                (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comGwDestIPduRefIndex)

#define COM_CFG_SIGGWMAP_SRCID(SignalGwMapIndex)                        (Com_ConfigStd->comSignalGwMapPB[SignalGwMapIndex].comGwSrcIndex)
#define COM_CFG_SIGGWMAP_DESTINDEXSTART(SignalGwMapIndex)               (Com_ConfigStd->comSignalGwMapPB[SignalGwMapIndex].comGwDestIndexStart)
/* DL201425 */
#define COM_CFG_SIGGWMAP_DESTINDEXSTOP(SignalGwMapIndex)                (Com_ConfigStd->comSignalGwMapPB[SignalGwMapIndex].comGwDestIndexStop)

#define COM_CFG_SIGGRPGWMAP_SRCID(SignalGroupGwMapIndex)               (Com_ConfigStd->comSignalGroupGwMapPB[SignalGroupGwMapIndex].comGwSrcIndex)
#define COM_CFG_SIGGRPGWMAP_DESTINDEXSTART(SignalGroupGwMapIndex)      (Com_ConfigStd->comSignalGroupGwMapPB[SignalGroupGwMapIndex].comGwDestIndexStart)
/* DL201425 */
#define COM_CFG_SIGGRPGWMAP_DESTINDEXSTOP(SignalGroupGwMapIndex)       (Com_ConfigStd->comSignalGroupGwMapPB[SignalGroupGwMapIndex].comGwDestIndexStop)

/* DL201438 */
#define COM_CFG_GWRXGRPSIGMAPTO_TXGRPSIGID(Index)                         (Com_ConfigStd->comGwMapRxGrpSigToTxGrpSigIdPB[Index])
#define COM_CFG_GWRXGSMAPTXGSIDARRAY_START(RxGroupSignalId)               (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGwMapToTxGrpSigIdStartIndex)
#define COM_CFG_GWRXGSMAPTXGSIDARRAY_STOP(RxGroupSignalId)                (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId].comGwMapToTxGrpSigIdStopIndex)
/* DL201438 */
#endif    /* end of STD_ON == COM_GATEWAY_ENABLE */


#if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))
#define COM_CFG_GWSRCDESC_UPDATEBITPOS(GwSourceDescId)         (Com_ConfigStd->comGwSrcDescPB[GwSourceDescId].comGwSrcUpdateBitPos)
#define COM_CFG_GWDESTDESC_UPDATEBITPOS(GwDestDescId)          (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comGwDestUpdateBitPos)
#endif  /* end of (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE) */


/* DL201429 */
#if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
/* DL201444 */
#define COM_CONST_DESTDESCRIPTMCSRT_NUM    (Com_ConfigStd->comDestDescripTMCSize)
/* DL201444 */
#define COM_CFG_GWDESTDESC_FILTERFUNCINDEX(GwDestDescId)         (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comFilterFuncIndex)
#define COM_CFG_GWDESTDESC_FILTERPARAINDEX(GwDestDescId)         (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comFilterIndex)
#define COM_CFG_GWDESTDESC_FTMCINDEX(GwDestDescId)               (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comTMCIndex)
#define COM_CFG_GWDESTDESC_FOCCURENCEINDEX(GwDestDescId)         (Com_ConfigStd->comGwDestDescPB[GwDestDescId].comFilterOccurceIndex)

/* DL201442 */
#define COM_CFG_GWDESTDESC_INITTMC(GwDestDescTMCIndex)           (Com_ConfigStd->comDestDescripInitTMC[GwDestDescTMCIndex])
/* DL201442 */
#endif    /* end of (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE) */

#if (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))      \
     || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE)))
#define COM_CFG_GWDESTDESC_IDSTART(TxIPduId)                     (Com_ConfigStd->comTxIPduPB[TxIPduId].comDestDescripStart)
#define COM_CFG_GWDESTDESC_IDSTOP(TxIPduId)                      (Com_ConfigStd->comTxIPduPB[TxIPduId].comDestDescripStop)
#endif
/* (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
     || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))) */
/* DL201429 */


#if (STD_ON == COM_DEV_ERROR_DETECT)
#define COM_RXSIGNALNUM                        (Com_RxSignalNumber)
#define COM_TXSIGNALNUM                        (Com_TxSignalNumber)
#define COM_RXSIGNALGROUPNUM                   (Com_RxSignalGroupNumber)
#define COM_TXSIGNALGROUPNUM                   (Com_TxSignalGroupNumber)
#define COM_RXGROUPSIGNALNUM                   (Com_RxGroupSignalNumber)
#define COM_TXGROUPSIGNALNUM                   (Com_TxGroupSignalNumber)
#endif


#endif   /* end of COM_VARIANT_PB == COM_VARIANT_CFG */

#if (COM_VARIANT_LT == COM_VARIANT_CFG)
#define COM_CONST_RXIPDU_NUM                        (Com_RxIPduNum)
#define COM_CONST_TXIPDU_NUM                        (Com_TxIPduNum)
#define COM_CONST_TXSIGNALGROUP_NUM                 (Com_TxSignalGroupNum)
#define COM_CONST_RXIPDUBUFF_SIZE                   (Com_RxIPduBuffSize)
#define COM_CONST_TXIPDUBUFF_SIZE                   (Com_TxIPduBuffSize)
#define COM_CONST_SIGNALBOOLBUFF_SIZE               (Com_SignalBoolBuffSize)
#define COM_CONST_SIGNAL8BITBUFF_SIZE                    (Com_Signal8BitBuffSize)
#define COM_CONST_SIGNAL16BITBUFF_SIZE                   (Com_Signal16BitBuffSize)
#define COM_CONST_SIGNAL32BITBUFF_SIZE                   (Com_Signal32BitBuffSize)
#define COM_CONST_RXGRPSIGBOOLBUFF_SIZE                  (Com_RxGroupSignalBoolBuffSize)
#define COM_CONST_RXGRPSIG8BITBUFF_SIZE                  (Com_RxGroupSignal8BitBuffSize)
#define COM_CONST_RXGRPSIG16BITBUFF_SIZE                 (Com_RxGroupSignal16BitBuffSize)
#define COM_CONST_RXGRPSIG32BITBUFF_SIZE                 (Com_RxGroupSignal32BitBuffSize)

#define COM_CFG_SIGNALBOOL_INITVALUE(SignalValueIndex)        (Com_SignalBoolInitValue[SignalValueIndex])
#define COM_CFG_SIGNAL8BIT_INITVALUE(SignalValueIndex)        (Com_Signal8BitInitValue[SignalValueIndex])
#define COM_CFG_SIGNAL16BIT_INITVALUE(SignalValueIndex)       (Com_Signal16BitInitValue[SignalValueIndex])
#define COM_CFG_SIGNAL32BIT_INITVALUE(SignalValueIndex)       (Com_Signal32BitInitValue[SignalValueIndex])

#define COM_CFG_RXGRPSIGBOOL_INITVALUE(GrpSigValueIndex)      (Com_RxGroupSignalBoolInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG8BIT_INITVALUE(GrpSigValueIndex)      (Com_RxGroupSignal8BitInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG16BIT_INITVALUE(GrpSigValueIndex)     (Com_RxGroupSignal16BitInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG32BIT_INITVALUE(GrpSigValueIndex)     (Com_RxGroupSignal32BitInitValue[GrpSigValueIndex])

#define COM_CFG_SIGNALBOOL_INVALIDVALUE(SignalValueIndex)         (Com_SignalBoolInvVal[SignalValueIndex])
#define COM_CFG_SIGNAL8BIT_INVALIDVALUE(SignalValueIndex)         (Com_Signal8BitInvVal[SignalValueIndex])
#define COM_CFG_SIGNAL16BIT_INVALIDVALUE(SignalValueIndex)        (Com_Signal16BitInvVal[SignalValueIndex])
#define COM_CFG_SIGNAL32BIT_INVALIDVALUE(SignalValueIndex)        (Com_Signal32BitInvVal[SignalValueIndex])

#define COM_CFG_RXIPDU_INITVALUE(ValueIndex)                (Com_RxIPduInitValue[ValueIndex])
#define COM_CFG_TXIPDU_INITVALUE(ValueIndex)                (Com_TxIPduInitValue[ValueIndex])

#define COM_CONST_CONFIG_ID                                   (COM_CONFIGURATION_ID)

#define COM_CFG_IPDUGROUP_FLAG(IPduGroupId)               (Com_IPduGroupPB[IPduGroupId].comIPduGroupFlag)
#define COM_CFG_SUBIPDUGROUPID_START(ParentIPduGroup)    (Com_IPduGroupPB[ParentIPduGroup].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_SUBIPDUGROUPID_STOP(ParentIPduGroup)         (Com_IPduGroupPB[ParentIPduGroup].comIPduOrGroupStop)

#define COM_CFG_RXIPDU_INDEX_START(IPduGroupId)    (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_RXIPDU_INDEX_STOP(IPduGroupId)     (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStop)
#define COM_CFG_RXIPDU_ID(RxIPduIndex)             (Com_RxIPduIdMapPB[RxIPduIndex])

#define COM_CFG_TXIPDU_INDEX_START(IPduGroupId)    (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_TXIPDU_INDEX_STOP(IPduGroupId)     (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStop)
#define COM_CFG_TXIPDU_ID(TxIPduIndex)             (Com_TxIPduIdMapPB[TxIPduIndex])

#define COM_CFG_RXSIGNAL_INDEX_START(RxIPduId)      (Com_RxIPduPB[RxIPduId].comSignalIndexStart)
/* DL201425 */
#define COM_CFG_RXSIGNAL_INDEX_STOP(RxIPduId)       (Com_RxIPduPB[RxIPduId].comSignalIndexStop)
#define COM_CFG_RXSIGNAL_ID(RxSignalIndex)          (RxSignalIndex)

#define COM_CFG_TXSIGNAL_INDEX_START(TxIPduId)      (Com_TxIPduPB[TxIPduId].comSignalIndexStart)
/* DL201425 */
#define COM_CFG_TXSIGNAL_INDEX_STOP(TxIPduId)       (Com_TxIPduPB[TxIPduId].comSignalIndexStop)
#define COM_CFG_TXSIGNAL_ID(TxSignalIndex)          (TxSignalIndex)

#define COM_CFG_RXSIGNALGROUP_INDEX_START(RxIPduId)      (Com_RxIPduPB[RxIPduId].comSignalGroupIndexStart)
/* DL201425 */
#define COM_CFG_RXSIGNALGROUP_INDEX_STOP(RxIPduId)       (Com_RxIPduPB[RxIPduId].comSignalGroupIndexStop)
#define COM_CFG_RXSIGNALGROUP_ID(RxSignalGroupIndex)     (RxSignalGroupIndex)

#define COM_CFG_TXSIGNALGROUP_INDEX_START(TxIPduId)      (Com_TxIPduPB[TxIPduId].comSignalGroupIndexStart)
/* DL201425 */
#define COM_CFG_TXSIGNALGROUP_INDEX_STOP(TxIPduId)       (Com_TxIPduPB[TxIPduId].comSignalGroupIndexStop)
#define COM_CFG_TXSIGNALGROUP_ID(TxSignalGroupIndex)     (TxSignalGroupIndex)

#define COM_CFG_TXMODE_TRUE(TxIPduId)               (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxMode)
#define COM_CFG_TXMODE_TRUE_N(TxIPduId)             (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_TRUE_NTCNTR(TxIPduId)       (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_TRUE_OFFSETCNTR(TxIPduId)        (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_TRUE_PERIODCNTR(TxIPduId)        (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeTimePeriod)

#define COM_CFG_RXIPDU_FLAG(RxIPduId)               (Com_RxIPduPB[RxIPduId].comIPduFlag)
#define COM_CFG_RXIPDU_SIZE(RxIPduId)               (Com_RxIPduPB[RxIPduId].comIPduSize)
#define COM_CFG_RXIPDU_FIRSTDM(RxIPduId)            (Com_RxIPduPB[RxIPduId].comIPduFirstDM)
#define COM_CFG_RXIPDU_DM(RxIPduId)                 (Com_RxIPduPB[RxIPduId].comIPduDM)
#define COM_CFG_RXIPDU_BUFFINDEX(RxIPduId)          (Com_RxIPduPB[RxIPduId].comRxIPduBufIndex)
#define COM_CFG_RXIPDU_IPDUGROUPMASK_L(RxIPduId)    (Com_RxIPduPB[RxIPduId].comIPduGroupMaskL)
#define COM_CFG_RXIPDU_IPDUGROUPMASK_H(RxIPduId)    (Com_RxIPduPB[RxIPduId].comIPduGroupMaskH)

#define COM_CFG_TXIPDU_FLAG(TxIPduId)               (Com_TxIPduPB[TxIPduId].comIPduFlag)
#define COM_CFG_LOWLAYER_PDUID(TxIPduId)            (Com_TxIPduPB[TxIPduId].comLowLayerPduId)
#define COM_CFG_TXIPDU_SIZE(TxIPduId)               (Com_TxIPduPB[TxIPduId].comIPduSize)
#define COM_CFG_TXIPDU_BUFFINDEX(TxIPduId)          (Com_TxIPduPB[TxIPduId].comTxIPduBufIndex)
#define COM_CFG_TXIPDU_TMSCNTRINIT(TxIPduId)        (Com_TxIPduPB[TxIPduId].comTxIPduTMSCntrInitVal)
#define COM_CFG_TXIPDU_MDT(TxIPduId)                (Com_TxIPduPB[TxIPduId].comIPduMDT)
#define COM_CFG_TXIPDU_DM(TxIPduId)                 (Com_TxIPduPB[TxIPduId].comIPduDM)
#define COM_CFG_TXIPDU_IPDUGROUPMASK_L(TxIPduId)    (Com_TxIPduPB[TxIPduId].comIPduGroupMaskL)
#define COM_CFG_TXIPDU_IPDUGROUPMASK_H(TxIPduId)    (Com_TxIPduPB[TxIPduId].comIPduGroupMaskH)

#define COM_CFG_RXSIGNAL_PBFLAG(RxSignalId)         (Com_RxSignalPB[RxSignalId].comSignalPBFlag)
#define COM_CFG_RXSIGNAL_ENDBYTE(RxSignalId)        (Com_RxSignalPB[RxSignalId].comSignalEndByte)
/* DL201434 */
#define COM_CFG_RXSIGNAL_LSBPOS(RxSignalId)         (Com_RxSignalPB[RxSignalId].comSignalLSBPos)
#define COM_CFG_RXSIGNAL_MSBPOS(RxSignalId)         (Com_RxSignalPB[RxSignalId].comSignalMSBPos)
/* DL201434 */
#define COM_CFG_RXSIGNAL_INVALIDVALUE_INDEX(RxSignalId)   (Com_RxSignalPB[RxSignalId].comSignalInvValueIndex)
#define COM_CFG_RXSIGNAL_VALUEINDEX(RxSignalId)     (Com_RxSignalPB[RxSignalId].comSignalBufIndex)
#define COM_CFG_RXSIGNAL_IPDUIDREF(RxSignalId)      (Com_RxSignalPB[RxSignalId].comIPduRefIndex)

#define COM_CFG_TXSIGNAL_PBFLAG(TxSignalId)           (Com_TxSignalPB[TxSignalId].comSignalPBFlag)
/* DL201434 */
#define COM_CFG_TXSIGNAL_LSBPOS(TxSignalId)           (Com_TxSignalPB[TxSignalId].comSignalLSBPos)
#define COM_CFG_TXSIGNAL_MSBPOS(TxSignalId)           (Com_TxSignalPB[TxSignalId].comSignalMSBPos)
/* DL201434 */
#define COM_CFG_TXSIGNAL_VALUEINDEX(TxSignalId)       (Com_TxSignalPB[TxSignalId].comSignalBufIndex)
#define COM_CFG_TXSIGNAL_INVALIDVALUE_INDEX(TxSignalId)     (Com_TxSignalPB[TxSignalId].comSignalnvValueIndex)
#define COM_CFG_TXSIGNAL_IPDUIDREF(TxSignalId)        (Com_TxSignalPB[TxSignalId].comIPduRefIndex)

#define COM_CFG_RXSIGNALGROUP_ENDBYTE(RxSignalGroupId)      (Com_RxSignalGroupPB[RxSignalGroupId].comSignalGroupEndByte)
#define COM_CFG_RXSIGNALGROUP_IPDUIDREF(RxSignalGroupId)    (Com_RxSignalGroupPB[RxSignalGroupId].comIPduRefIndex)

#define COM_CFG_TXSIGNALGROUP_PBFLAG(TxSignalGroupId)       (Com_TxSignalGroupPB[TxSignalGroupId].comSignalGroupPBFlag)
#define COM_CFG_TXSIGNALGROUP_IPDUIDREF(TxSignalGroupId)    (Com_TxSignalGroupPB[TxSignalGroupId].comIPduRefIndex)

#define COM_CFG_RXGRPSIG_PBFLAG(RxGroupSignalId)         (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalPBFlag)
/* DL201434 */
#define COM_CFG_RXGRPSIG_LSBPOS(RxGroupSignalId)            (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalLSBPos)
#define COM_CFG_RXGRPSIG_MSBPOS(RxGroupSignalId)            (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalMSBPos)
/* DL201434 */
#define COM_CFG_RXGRPSIG_VALUEINDEX(RxGroupSignalId)     (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalBufIndex)
#define COM_CFG_RXGRPSIG_INVLDVALUE_INDEX(RxGroupSignalId)   (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalInvValueIndex)

#define COM_CFG_TXGRPSIG_PBFLAG(TxGroupSignalId)           (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalPBFlag)
/* DL201434 */
#define COM_CFG_TXGRPSIG_LSBPOS(TxGroupSignalId)              (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalLSBPos)
#define COM_CFG_TXGRPSIG_MSBPOS(TxGroupSignalId)              (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalMSBPos)
/* DL201434 */
#define COM_CFG_TXGRPSIG_VALUEINDEX(TxGroupSignalId)       (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalBufIndex)
#define COM_CFG_TXGRPSIG_INVLDVALUE_INDEX(TxGroupSignalId)     (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalInvValueIndex)


#if (STD_ON == COM_FILTER_ENABLE)
#define COM_CONST_RXSIGNALONEEVERYN_NUM              (Com_RxSignalOneEveryNNum)
#define COM_CONST_TXSIGNALTMCRST_NUM                 (Com_TxSignalTMCRSTNum)
#define COM_CONST_TXSIGNALONEEVERYN_NUM              (Com_TxSignalOneEveryNNum)
#define COM_CONST_TXGRPSIGONEEVERYN_NUM              (Com_TxGroupSignalOneEveryNNum)
#define COM_CONST_TXSIGNALGROUPTMC_NUM               (Com_TxSignalGroupTMCNum)
#define COM_COMST_TXGROUPSIGNALTMCSRT_NUM            (Com_TxGroupSignalTMCRSTNum)
#define COM_CONST_RXSIGNALNOBBOOLSIZE                (Com_RxSignalNOBBoolSize)
#define COM_CONST_RXSIGNALNOB8BITSIZE                (Com_RxSignalNOB8BitSize)
#define COM_CONST_RXSIGNALNOB16BITSIZE               (Com_RxSignalNOB16BitSize)
#define COM_CONST_RXSIGNALNOB32BITSIZE               (Com_RxSignalNOB32BitSize)

#define COM_CFG_RXSIGNOBBOOL_INITVALUE(SignalValueIndex)         (Com_RxSignalNOBBoolInitValue[SignalValueIndex])
#define COM_CFG_RXSIGNOB8BIT_INITVALUE(SignalValueIndex)         (Com_RxSignalNOB8BitInitValue[SignalValueIndex])
#define COM_CFG_RXSIGNOB16BIT_INITVALUE(SignalValueIndex)        (Com_RxSignalNOB16BitInitValue[SignalValueIndex])
#define COM_CFG_RXSIGNOB32BIT_INITVALUE(SignalValueIndex)        (Com_RxSignalNOB32BitInitValue[SignalValueIndex])

#define COM_CFG_RXSIGNAL_FILTERFNCINDEX(RxSignalId)      (Com_RxSignalPB[RxSignalId].comFilterFuncIndex)
#define COM_CFG_TXSIGNAL_FILTERFNCINDEX(TxSignalId)      (Com_TxSignalPB[TxSignalId].comFilterFuncIndex)
#define COM_CFG_TXGRPSIG_FILTERFNCINDEX(TxGroupSignalId) (Com_TxGroupSignalPB[TxGroupSignalId].comFilterFuncIndex)

#define COM_CFG_TXMODE_FALSE(TxIPduId)              (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxMode)
#define COM_CFG_TXMODE_FALSE_N(TxIPduId)            (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_FALSE_NTCNTR(TxIPduId)      (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_FALSE_OFFSETCNTR(TxIPduId)       (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_FALSE_PERIODCNTR(TxIPduId)       (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeTimePeriod)

/* DL201442 */
#define COM_CFG_TXSIGNAL_INITTMC(TXSignalTMCIndex)    (Com_TxSignalInitTMC[TXSignalTMCIndex])
#define COM_CFG_TXGRPSIG_INITTMC(TXGrpSigTMCIndex)    (Com_TxGroupSignalInitTMC[TXGrpSigTMCIndex])
#define COM_CFG_TXSIGGRP_INITTMC(TxSigGrpTMCIndex)    (Com_TxSignalGroupInitTMCCntr[TxSigGrpTMCIndex])
/* DL201442 */

#endif    /* end of STD_ON == COM_FILTER_ENABLE */


#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define COM_CONST_SIGNAL_DM_CNTRNUM                    (Com_SignalDMCntrNum)
#define COM_CONST_SIGGRP_DM_CNTRNUM               (Com_SignalGroupDMCntrNum)

#define COM_CFG_SIGNALID_FROMDMINDEX(SignalDMIndex)              (Com_RxUpdateSignalId[SignalDMIndex])
#define COM_CFG_SIGGRPID_FROMDMINDEX(SignalGroupDMIndex)    (Com_RxUpdateSignalGrouplId[SignalGroupDMIndex])

#define COM_CFG_RXSIGNAL_UPDATEBITPOS(RxSignalId)               (Com_RxSignalPB[RxSignalId].comSignalUpdateBitPos)
#define COM_CFG_RXSIGNAL_DMINDEX(RxSignalId)                    (Com_RxSignalPB[RxSignalId].comSignalDMIndex)

#define COM_CFG_TXSIGNAL_UPDATEBITPOS(TxSignalId)               (Com_TxSignalPB[TxSignalId].comSignalUpdateBitPos)

#define COM_CFG_RXSIGGRP_UPDATEBITPOS(RxSignalGroupId)          (Com_RxSignalGroupPB[RxSignalGroupId].comUpdateBitPos)
#define COM_CFG_RXSIGGRP_DMINDEX(RxSignalGroupId)               (Com_RxSignalGroupPB[RxSignalGroupId].comSignalGroupDMIndex)

#define COM_CFG_TXSIGGRP_UPDATEBITPOS(TxSignalGroupId)          (Com_TxSignalGroupPB[TxSignalGroupId].comUpdateBitPos)
#endif    /* end of STD_ON == COM_UPDATEBIT_ENABLE */


#if (STD_ON == COM_GATEWAY_ENABLE)
/* DL201437 */
#define COM_CFG_GWRXIPDU_NUMBER                     (Com_GwRxIPduBuffSize)
#define COM_CFG_GWTXIPDU_NUMBER                     (Com_GwTxIPduBuffSize)
/* DL201437 */

/* DL201428 */
#define COM_CFG_GWRXIPDUID(RxIdArrayIndex)          (Com_GwRxIPduIdPB[RxIdArrayIndex])
#define COM_CFG_GWTXIPDUID(TxIdArrayIndex)          (Com_GwTxIPduIdPB[TxIdArrayIndex])

#define COM_CFG_RXSIGGWMAP_STARTINDEX(RxIPduId)     (Com_RxIPduPB[RxIPduId].comSignalGwMapStart)
/* DL201425 */
#define COM_CFG_RXSIGGWMAP_STOPINDEX(RxIPduId)      (Com_RxIPduPB[RxIPduId].comSignalGwMapStop)
#define COM_CFG_RXSIGGRPMAP_STARTINDEX(RxIPduId)    (Com_RxIPduPB[RxIPduId].comSignalGroupGwMapStart)
/* DL201425 */
#define COM_CFG_RXSIGGRPMAP_STOPINDEX(RxIPduId)     (Com_RxIPduPB[RxIPduId].comSignalGroupGwMapStop)

#define COM_CFG_DEST_ID(DestArrayIndex)             (Com_GwDestIdPB[DestArrayIndex])

#define COM_CFG_GWSRCDESC_FLAG(GwSourceDescId)              (Com_SrcDescPB[GwSourceDescId].comGwSrcFlag)
#define COM_CFG_GWSRCDESC_SIZE(GwSourceDescId)              (Com_SrcDescPB[GwSourceDescId].comGwSrcSize)
#define COM_CFG_GWSRCDESC_ENDBYTE(GwSourceDescId)           (Com_SrcDescPB[GwSourceDescId].comGwSrcEndByte)
/* DL201434 */
#define COM_CFG_GWSRCDESC_LSBPOS(GwSourceDescId)               (Com_SrcDescPB[GwSourceDescId].comGwSrcLSBPos)
#define COM_CFG_GWSRCDESC_MSBPOS(GwSourceDescId)               (Com_SrcDescPB[GwSourceDescId].comGwSrcMSBPos)
/* DL201434 */
#define COM_CFG_GWSRCDESC_IPDUIDREF(GwSourceDescId)         (Com_SrcDescPB[GwSourceDescId].comGwSrcIPduRefIndex)

#define COM_CFG_GWDESTDESC_FLAG(GwDestDescId)               (Com_DestDescPB[GwDestDescId].comGwDestFlag)
/* DL201434 */
#define COM_CFG_GWDESTDESC_LSBPOS(GwDestDescId)                (Com_DestDescPB[GwDestDescId].comGwDestLSBPos)
#define COM_CFG_GWDESTDESC_MSBPOS(GwDestDescId)                (Com_DestDescPB[GwDestDescId].comGwDestMSBPos)
/* DL201434 */
#define COM_CFG_GWDESTDESC_VALUEINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comGwDestBufIndex)
#define COM_CFG_GWDESTDESC_IPDUIDREF(GwDestDescId)          (Com_DestDescPB[GwDestDescId].comGwDestIPduRefIndex)

#define COM_CFG_SIGGWMAP_SRCID(SignalGwMapIndex)               (Com_SignalGwMapPB[SignalGwMapIndex].comGwSrcIndex)
#define COM_CFG_SIGGWMAP_DESTINDEXSTART(SignalGwMapIndex)      (Com_SignalGwMapPB[SignalGwMapIndex].comGwDestIndexStart)
/* DL201425 */
#define COM_CFG_SIGGWMAP_DESTINDEXSTOP(SignalGwMapIndex)       (Com_SignalGwMapPB[SignalGwMapIndex].comGwDestIndexStop)

#define COM_CFG_SIGGRPGWMAP_SRCID(SignalGroupGwMapIndex)               (Com_SGroupGwMapPB[SignalGroupGwMapIndex].comGwSrcIndex)
#define COM_CFG_SIGGRPGWMAP_DESTINDEXSTART(SignalGroupGwMapIndex)      (Com_SGroupGwMapPB[SignalGroupGwMapIndex].comGwDestIndexStart)
/* DL201425 */
#define COM_CFG_SIGGRPGWMAP_DESTINDEXSTOP(SignalGroupGwMapIndex)       (Com_SGroupGwMapPB[SignalGroupGwMapIndex].comGwDestIndexStop)

/* DL201438 */
#define COM_CFG_GWRXGRPSIGMAPTO_TXGRPSIGID(Index)                         (Com_GwMapRxGrpSigToTxGrpSigIdPB[Index])
#define COM_CFG_GWRXGSMAPTXGSIDARRAY_START(RxGroupSignalId)               (Com_RxGroupSignalPB[RxGroupSignalId].comGwMapToTxGrpSigIdStartIndex)
#define COM_CFG_GWRXGSMAPTXGSIDARRAY_STOP(RxGroupSignalId)                (Com_RxGroupSignalPB[RxGroupSignalId].comGwMapToTxGrpSigIdStopIndex)
/* DL201438 */
#endif    /* end of STD_ON == COM_GATEWAY_ENABLE */


#if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))
#define COM_CFG_GWSRCDESC_UPDATEBITPOS(GwSourceDescId)         (Com_SrcDescPB[GwSourceDescId].comGwSrcUpdateBitPos)
#define COM_CFG_GWDESTDESC_UPDATEBITPOS(GwDestDescId)          (Com_DestDescPB[GwDestDescId].comGwDestUpdateBitPos)
#endif  /* end of (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE) */


/* DL201429 */
#if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
/* DL201444 */
#define COM_CONST_DESTDESCRIPTMCSRT_NUM    (Com_DestDescripTMCRSTNum)
/* DL201444 */
#define COM_CFG_GWDESTDESC_FILTERFUNCINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comFilterFuncIndex)
#define COM_CFG_GWDESTDESC_FILTERPARAINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comFilterIndex)
#define COM_CFG_GWDESTDESC_FTMCINDEX(GwDestDescId)               (Com_DestDescPB[GwDestDescId].comTMCIndex)
#define COM_CFG_GWDESTDESC_FOCCURENCEINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comFilterOccurceIndex)

/* DL201442 */
#define COM_CFG_GWDESTDESC_INITTMC(GwDestDescTMCIndex)           (Com_DestDescripInitTMC[GwDestDescTMCIndex])
/* DL201442 */
#endif  /* end of (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE) */

#if (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))      \
     || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE)))
#define COM_CFG_GWDESTDESC_IDSTART(TxIPduId)                     (Com_TxIPduPB[TxIPduId].comDestDescripStart)
#define COM_CFG_GWDESTDESC_IDSTOP(TxIPduId)                      (Com_TxIPduPB[TxIPduId].comDestDescripStop)
#endif
/* (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
     || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))) */
/* DL201429 */


#if (STD_ON == COM_DEV_ERROR_DETECT)
#define COM_RXSIGNALNUM                        (Com_RxSignalNumber)
#define COM_TXSIGNALNUM                        (Com_TxSignalNumber)
#define COM_RXSIGNALGROUPNUM                   (Com_RxSignalGroupNumber)
#define COM_TXSIGNALGROUPNUM                   (Com_TxSignalGroupNumber)
#define COM_RXGROUPSIGNALNUM                   (Com_RxGroupSignalNumber)
#define COM_TXGROUPSIGNALNUM                   (Com_TxGroupSignalNumber)
#endif

#endif    /* end of COM_VARIANT_LT == COM_VARIANT_CFG */


#if (COM_VARIANT_PC == COM_VARIANT_CFG)
#define COM_CONST_RXIPDU_NUM                        (COM_RXIPDU_NUMBER)
#define COM_CONST_TXIPDU_NUM                        (COM_TXIPDU_NUMBER)
#define COM_CONST_TXSIGNALGROUP_NUM                 (COM_TXSIGNALGROUP_NUMBER)
#define COM_CONST_RXIPDUBUFF_SIZE                   (COM_RXIPDUBUFF_SIZE)
#define COM_CONST_TXIPDUBUFF_SIZE                   (COM_TXIPDUBUFF_SIZE)
#define COM_CONST_SIGNALBOOLBUFF_SIZE               (COM_SIGNAL_BOOLBUFF_SIZE)
#define COM_CONST_SIGNAL8BITBUFF_SIZE                    (COM_SIGNAL_8BITBUFF_SIZE)
#define COM_CONST_SIGNAL16BITBUFF_SIZE                   (COM_SIGNAL_16BITBUFF_SIZE)
#define COM_CONST_SIGNAL32BITBUFF_SIZE                   (COM_SIGNAL_32BITBUFF_SIZE)
#define COM_CONST_RXGRPSIGBOOLBUFF_SIZE                  (COM_RXGROUPSIGNAL_BOOLBUFF_SIZE)
#define COM_CONST_RXGRPSIG8BITBUFF_SIZE                  (COM_RXGROUPSIGNAL_8BITBUFF_SIZE)
#define COM_CONST_RXGRPSIG16BITBUFF_SIZE                 (COM_RXGROUPSIGNAL_16BITBUFF_SIZE)
#define COM_CONST_RXGRPSIG32BITBUFF_SIZE                 (COM_RXGROUPSIGNAL_32BITBUFF_SIZE)

#define COM_CFG_SIGNALBOOL_INITVALUE(SignalValueIndex)        (Com_SignalBoolInitValue[SignalValueIndex])
#define COM_CFG_SIGNAL8BIT_INITVALUE(SignalValueIndex)        (Com_Signal8BitInitValue[SignalValueIndex])
#define COM_CFG_SIGNAL16BIT_INITVALUE(SignalValueIndex)       (Com_Signal16BitInitValue[SignalValueIndex])
#define COM_CFG_SIGNAL32BIT_INITVALUE(SignalValueIndex)       (Com_Signal32BitInitValue[SignalValueIndex])

#define COM_CFG_RXGRPSIGBOOL_INITVALUE(GrpSigValueIndex)      (Com_RxGroupSignalBoolInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG8BIT_INITVALUE(GrpSigValueIndex)      (Com_RxGroupSignal8BitInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG16BIT_INITVALUE(GrpSigValueIndex)     (Com_RxGroupSignal16BitInitValue[GrpSigValueIndex])
#define COM_CFG_RXGRPSIG32BIT_INITVALUE(GrpSigValueIndex)     (Com_RxGroupSignal32BitInitValue[GrpSigValueIndex])

#define COM_CFG_SIGNALBOOL_INVALIDVALUE(SignalValueIndex)         (Com_SignalBoolInvVal[SignalValueIndex])
#define COM_CFG_SIGNAL8BIT_INVALIDVALUE(SignalValueIndex)         (Com_Signal8BitInvVal[SignalValueIndex])
#define COM_CFG_SIGNAL16BIT_INVALIDVALUE(SignalValueIndex)        (Com_Signal16BitInvVal[SignalValueIndex])
#define COM_CFG_SIGNAL32BIT_INVALIDVALUE(SignalValueIndex)        (Com_Signal32BitInvVal[SignalValueIndex])

#define COM_CFG_RXIPDU_INITVALUE(ValueIndex)                (Com_RxIPduInitValue[ValueIndex])
#define COM_CFG_TXIPDU_INITVALUE(ValueIndex)                (Com_TxIPduInitValue[ValueIndex])

#define COM_CONST_CONFIG_ID                                 (COM_CONFIGURATION_ID)

#define COM_CFG_IPDUGROUP_FLAG(IPduGroupId)               (Com_IPduGroupPB[IPduGroupId].comIPduGroupFlag)
#define COM_CFG_SUBIPDUGROUPID_START(ParentIPduGroup)     (Com_IPduGroupPB[ParentIPduGroup].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_SUBIPDUGROUPID_STOP(ParentIPduGroup)      (Com_IPduGroupPB[ParentIPduGroup].comIPduOrGroupStop)

#define COM_CFG_RXIPDU_INDEX_START(IPduGroupId)    (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_RXIPDU_INDEX_STOP(IPduGroupId)     (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStop)
#define COM_CFG_RXIPDU_ID(RxIPduIndex)             (Com_RxIPduIdMapPB[RxIPduIndex])

#define COM_CFG_TXIPDU_INDEX_START(IPduGroupId)    (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStart)
/* DL201425 */
#define COM_CFG_TXIPDU_INDEX_STOP(IPduGroupId)     (Com_IPduGroupPB[IPduGroupId].comIPduOrGroupStop)
#define COM_CFG_TXIPDU_ID(TxIPduIndex)             (Com_TxIPduIdMapPB[TxIPduIndex])

#define COM_CFG_RXSIGNAL_INDEX_START(RxIPduId)      (Com_RxIPduPB[RxIPduId].comSignalIndexStart)
/* DL201425 */
#define COM_CFG_RXSIGNAL_INDEX_STOP(RxIPduId)       (Com_RxIPduPB[RxIPduId].comSignalIndexStop)
#define COM_CFG_RXSIGNAL_ID(RxSignalIndex)          (RxSignalIndex)

#define COM_CFG_TXSIGNAL_INDEX_START(TxIPduId)      (Com_TxIPduPB[TxIPduId].comSignalIndexStart)
/* DL201425 */
#define COM_CFG_TXSIGNAL_INDEX_STOP(TxIPduId)       (Com_TxIPduPB[TxIPduId].comSignalIndexStop)
#define COM_CFG_TXSIGNAL_ID(TxSignalIndex)          (TxSignalIndex)

#define COM_CFG_RXSIGNALGROUP_INDEX_START(RxIPduId)      (Com_RxIPduPB[RxIPduId].comSignalGroupIndexStart)
/* DL201425 */
#define COM_CFG_RXSIGNALGROUP_INDEX_STOP(RxIPduId)       (Com_RxIPduPB[RxIPduId].comSignalGroupIndexStop)
#define COM_CFG_RXSIGNALGROUP_ID(RxSignalGroupIndex)     (RxSignalGroupIndex)

#define COM_CFG_TXSIGNALGROUP_INDEX_START(TxIPduId)      (Com_TxIPduPB[TxIPduId].comSignalGroupIndexStart)
/* DL201425 */
#define COM_CFG_TXSIGNALGROUP_INDEX_STOP(TxIPduId)       (Com_TxIPduPB[TxIPduId].comSignalGroupIndexStop)
#define COM_CFG_TXSIGNALGROUP_ID(TxSignalGroupIndex)     (TxSignalGroupIndex)

#define COM_CFG_TXMODE_TRUE(TxIPduId)               (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxMode)
#define COM_CFG_TXMODE_TRUE_N(TxIPduId)             (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_TRUE_NTCNTR(TxIPduId)        (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_TRUE_OFFSETCNTR(TxIPduId)        (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_TRUE_PERIODCNTR(TxIPduId)        (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeTrueIndex].comTxModeTimePeriod)

#define COM_CFG_RXIPDU_FLAG(RxIPduId)               (Com_RxIPduPB[RxIPduId].comIPduFlag)
#define COM_CFG_RXIPDU_SIZE(RxIPduId)               (Com_RxIPduPB[RxIPduId].comIPduSize)
#define COM_CFG_RXIPDU_FIRSTDM(RxIPduId)            (Com_RxIPduPB[RxIPduId].comIPduFirstDM)
#define COM_CFG_RXIPDU_DM(RxIPduId)                 (Com_RxIPduPB[RxIPduId].comIPduDM)
#define COM_CFG_RXIPDU_BUFFINDEX(RxIPduId)          (Com_RxIPduPB[RxIPduId].comRxIPduBufIndex)
#define COM_CFG_RXIPDU_IPDUGROUPMASK_L(RxIPduId)    (Com_RxIPduPB[RxIPduId].comIPduGroupMaskL)
#define COM_CFG_RXIPDU_IPDUGROUPMASK_H(RxIPduId)    (Com_RxIPduPB[RxIPduId].comIPduGroupMaskH)

#define COM_CFG_TXIPDU_FLAG(TxIPduId)               (Com_TxIPduPB[TxIPduId].comIPduFlag)
#define COM_CFG_LOWLAYER_PDUID(TxIPduId)            (Com_TxIPduPB[TxIPduId].comLowLayerPduId)
#define COM_CFG_TXIPDU_SIZE(TxIPduId)               (Com_TxIPduPB[TxIPduId].comIPduSize)
#define COM_CFG_TXIPDU_BUFFINDEX(TxIPduId)          (Com_TxIPduPB[TxIPduId].comTxIPduBufIndex)
#define COM_CFG_TXIPDU_TMSCNTRINIT(TxIPduId)        (Com_TxIPduPB[TxIPduId].comTxIPduTMSCntrInitVal)
#define COM_CFG_TXIPDU_MDT(TxIPduId)                (Com_TxIPduPB[TxIPduId].comIPduMDT)
#define COM_CFG_TXIPDU_DM(TxIPduId)                 (Com_TxIPduPB[TxIPduId].comIPduDM)
#define COM_CFG_TXIPDU_IPDUGROUPMASK_L(TxIPduId)    (Com_TxIPduPB[TxIPduId].comIPduGroupMaskL)
#define COM_CFG_TXIPDU_IPDUGROUPMASK_H(TxIPduId)    (Com_TxIPduPB[TxIPduId].comIPduGroupMaskH)

#define COM_CFG_RXSIGNAL_PBFLAG(RxSignalId)                 (Com_RxSignalPB[RxSignalId].comSignalPBFlag)
#define COM_CFG_RXSIGNAL_ENDBYTE(RxSignalId)                (Com_RxSignalPB[RxSignalId].comSignalEndByte)
/* DL201434 */
#define COM_CFG_RXSIGNAL_LSBPOS(RxSignalId)                 (Com_RxSignalPB[RxSignalId].comSignalLSBPos)
#define COM_CFG_RXSIGNAL_MSBPOS(RxSignalId)                 (Com_RxSignalPB[RxSignalId].comSignalMSBPos)
/* DL201434 */
#define COM_CFG_RXSIGNAL_INVALIDVALUE_INDEX(RxSignalId)     (Com_RxSignalPB[RxSignalId].comSignalInvValueIndex)
#define COM_CFG_RXSIGNAL_VALUEINDEX(RxSignalId)             (Com_RxSignalPB[RxSignalId].comSignalBufIndex)
#define COM_CFG_RXSIGNAL_IPDUIDREF(RxSignalId)              (Com_RxSignalPB[RxSignalId].comIPduRefIndex)

#define COM_CFG_TXSIGNAL_PBFLAG(TxSignalId)                 (Com_TxSignalPB[TxSignalId].comSignalPBFlag)
/* DL201434 */
#define COM_CFG_TXSIGNAL_LSBPOS(TxSignalId)                 (Com_TxSignalPB[TxSignalId].comSignalLSBPos)
#define COM_CFG_TXSIGNAL_MSBPOS(TxSignalId)                 (Com_TxSignalPB[TxSignalId].comSignalMSBPos)
/* DL201434 */
#define COM_CFG_TXSIGNAL_VALUEINDEX(TxSignalId)             (Com_TxSignalPB[TxSignalId].comSignalBufIndex)
#define COM_CFG_TXSIGNAL_INVALIDVALUE_INDEX(TxSignalId)     (Com_TxSignalPB[TxSignalId].comSignalnvValueIndex)
#define COM_CFG_TXSIGNAL_IPDUIDREF(TxSignalId)              (Com_TxSignalPB[TxSignalId].comIPduRefIndex)

#define COM_CFG_RXSIGNALGROUP_ENDBYTE(RxSignalGroupId)      (Com_RxSignalGroupPB[RxSignalGroupId].comSignalGroupEndByte)
#define COM_CFG_RXSIGNALGROUP_IPDUIDREF(RxSignalGroupId)    (Com_RxSignalGroupPB[RxSignalGroupId].comIPduRefIndex)

#define COM_CFG_TXSIGNALGROUP_PBFLAG(TxSignalGroupId)       (Com_TxSignalGroupPB[TxSignalGroupId].comSignalGroupPBFlag)
#define COM_CFG_TXSIGNALGROUP_IPDUIDREF(TxSignalGroupId)    (Com_TxSignalGroupPB[TxSignalGroupId].comIPduRefIndex)

#define COM_CFG_RXGRPSIG_PBFLAG(RxGroupSignalId)             (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalPBFlag)
/* DL201434 */
#define COM_CFG_RXGRPSIG_LSBPOS(RxGroupSignalId)                (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalLSBPos)
#define COM_CFG_RXGRPSIG_MSBPOS(RxGroupSignalId)                (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalMSBPos)
/* DL201434 */
#define COM_CFG_RXGRPSIG_VALUEINDEX(RxGroupSignalId)         (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalBufIndex)
#define COM_CFG_RXGRPSIG_INVLDVALUE_INDEX(RxGroupSignalId)   (Com_RxGroupSignalPB[RxGroupSignalId].comGroupSignalInvValueIndex)

#define COM_CFG_TXGRPSIG_PBFLAG(TxGroupSignalId)               (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalPBFlag)
/* DL201434 */
#define COM_CFG_TXGRPSIG_LSBPOS(TxGroupSignalId)                  (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalLSBPos)
#define COM_CFG_TXGRPSIG_MSBPOS(TxGroupSignalId)                  (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalMSBPos)
/* DL201434 */
#define COM_CFG_TXGRPSIG_VALUEINDEX(TxGroupSignalId)           (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalBufIndex)
#define COM_CFG_TXGRPSIG_INVLDVALUE_INDEX(TxGroupSignalId)     (Com_TxGroupSignalPB[TxGroupSignalId].comGroupSignalInvValueIndex)


#if (STD_ON == COM_FILTER_ENABLE)
#define COM_CONST_RXSIGNALONEEVERYN_NUM              (COM_RXSIGNAL_ONEEVERYN_NUMBER)
#define COM_CONST_TXSIGNALTMCRST_NUM                 (COM_TXSIGNAL_TMCRST_NUMBER)
#define COM_CONST_TXSIGNALONEEVERYN_NUM              (COM_TXSIGNAL_ONEEVERYN_NUMBER)
#define COM_CONST_TXGRPSIGONEEVERYN_NUM              (COM_TXGRPSIG_ONEEVERYN_NUMBER)
#define COM_CONST_TXSIGNALGROUPTMC_NUM               (COM_TXSIGNALGROUP_TMCCNTR_NUNBER)
#define COM_COMST_TXGROUPSIGNALTMCSRT_NUM            (COM_TXGROUPSIGNAL_TMCRST_NUMBER)
#define COM_CONST_RXSIGNALNOBBOOLSIZE                (COM_RXSIGNAL_NOB_BOOLBUFF_SIZE)
#define COM_CONST_RXSIGNALNOB8BITSIZE                (COM_RXSIGNAL_NOB_8BITBUFF_SIZE)
#define COM_CONST_RXSIGNALNOB16BITSIZE               (COM_RXSIGNAL_NOB_16BITBUFF_SIZE)
#define COM_CONST_RXSIGNALNOB32BITSIZE               (COM_RXSIGNAL_NOB_32BITBUFF_SIZE)

#define COM_CFG_RXSIGNOBBOOL_INITVALUE(SignalValueIndex)         (Com_RxSignalNOBBoolInitValue[SignalValueIndex])
#define COM_CFG_RXSIGNOB8BIT_INITVALUE(SignalValueIndex)         (Com_RxSignalNOB8BitInitValue[SignalValueIndex])
#define COM_CFG_RXSIGNOB16BIT_INITVALUE(SignalValueIndex)        (Com_RxSignalNOB16BitInitValue[SignalValueIndex])
#define COM_CFG_RXSIGNOB32BIT_INITVALUE(SignalValueIndex)        (Com_RxSignalNOB32BitInitValue[SignalValueIndex])

#define COM_CFG_RXSIGNAL_FILTERFNCINDEX(RxSignalId)      (Com_RxSignalPB[RxSignalId].comFilterFuncIndex)
#define COM_CFG_TXSIGNAL_FILTERFNCINDEX(TxSignalId)      (Com_TxSignalPB[TxSignalId].comFilterFuncIndex)
#define COM_CFG_TXGRPSIG_FILTERFNCINDEX(TxGroupSignalId) (Com_TxGroupSignalPB[TxGroupSignalId].comFilterFuncIndex)

#define COM_CFG_TXMODE_FALSE(TxIPduId)                  (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxMode)
#define COM_CFG_TXMODE_FALSE_N(TxIPduId)                (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_FALSE_NTCNTR(TxIPduId)           (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_FALSE_OFFSETCNTR(TxIPduId)       (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_FALSE_PERIODCNTR(TxIPduId)       (Com_TxMode[Com_TxIPduPB[TxIPduId].comTxModeFalseIndex].comTxModeTimePeriod)

/* DL201442 */
#define COM_CFG_TXSIGNAL_INITTMC(TXSignalTMCIndex)    (Com_TxSignalInitTMC[TXSignalTMCIndex])
#define COM_CFG_TXGRPSIG_INITTMC(TXGrpSigTMCIndex)    (Com_TxGroupSignalInitTMC[TXGrpSigTMCIndex])
#define COM_CFG_TXSIGGRP_INITTMC(TxSigGrpTMCIndex)    (Com_TxSignalGroupInitTMCCntr[TxSigGrpTMCIndex])
/* DL201442 */

#endif    /* end of STD_ON == COM_FILTER_ENABLE */


#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define COM_CONST_SIGNAL_DM_CNTRNUM                    (COM_SIGNALDM_CNTRBUFF_SIZE)
#define COM_CONST_SIGGRP_DM_CNTRNUM               (COM_SIGNALGROUPDM_CNTRBUFF_SIZE)

#define COM_CFG_SIGNALID_FROMDMINDEX(SignalDMIndex)              (Com_RxUpdateSignalId[SignalDMIndex])
#define COM_CFG_SIGGRPID_FROMDMINDEX(SignalGroupDMIndex)    (Com_RxUpdateSignalGrouplId[SignalGroupDMIndex])

#define COM_CFG_RXSIGNAL_UPDATEBITPOS(RxSignalId)               (Com_RxSignalPB[RxSignalId].comSignalUpdateBitPos)
#define COM_CFG_RXSIGNAL_DMINDEX(RxSignalId)                    (Com_RxSignalPB[RxSignalId].comSignalDMIndex)

#define COM_CFG_TXSIGNAL_UPDATEBITPOS(TxSignalId)               (Com_TxSignalPB[TxSignalId].comSignalUpdateBitPos)

#define COM_CFG_RXSIGGRP_UPDATEBITPOS(RxSignalGroupId)          (Com_RxSignalGroupPB[RxSignalGroupId].comUpdateBitPos)
#define COM_CFG_RXSIGGRP_DMINDEX(RxSignalGroupId)               (Com_RxSignalGroupPB[RxSignalGroupId].comSignalGroupDMIndex)

#define COM_CFG_TXSIGGRP_UPDATEBITPOS(TxSignalGroupId)          (Com_TxSignalGroupPB[TxSignalGroupId].comUpdateBitPos)
#endif    /* end of STD_ON == COM_UPDATEBIT_ENABLE */


#if (STD_ON == COM_GATEWAY_ENABLE)
/* DL201437 */
#define COM_CFG_GWRXIPDU_NUMBER                     (COM_GWRXIPDU_BUFF_SIZE)
#define COM_CFG_GWTXIPDU_NUMBER                     (COM_GWTXIPDU_BUFF_SIZE)
/* DL201437 */

/* DL201428 */
#define COM_CFG_GWRXIPDUID(RxIdArrayIndex)          (Com_GwRxIPduIdPB[RxIdArrayIndex])
#define COM_CFG_GWTXIPDUID(TxIdArrayIndex)          (Com_GwTxIPduIdPB[TxIdArrayIndex])

#define COM_CFG_RXSIGGWMAP_STARTINDEX(RxIPduId)     (Com_RxIPduPB[RxIPduId].comSignalGwMapStart)
/* DL201425 */
#define COM_CFG_RXSIGGWMAP_STOPINDEX(RxIPduId)      (Com_RxIPduPB[RxIPduId].comSignalGwMapStop)
#define COM_CFG_RXSIGGRPMAP_STARTINDEX(RxIPduId)    (Com_RxIPduPB[RxIPduId].comSignalGroupGwMapStart)
/* DL201425 */
#define COM_CFG_RXSIGGRPMAP_STOPINDEX(RxIPduId)     (Com_RxIPduPB[RxIPduId].comSignalGroupGwMapStop)

#define COM_CFG_DEST_ID(DestArrayIndex)             (Com_GwDestIdPB[DestArrayIndex])

#define COM_CFG_GWSRCDESC_FLAG(GwSourceDescId)              (Com_SrcDescPB[GwSourceDescId].comGwSrcFlag)
#define COM_CFG_GWSRCDESC_SIZE(GwSourceDescId)              (Com_SrcDescPB[GwSourceDescId].comGwSrcSize)
#define COM_CFG_GWSRCDESC_ENDBYTE(GwSourceDescId)           (Com_SrcDescPB[GwSourceDescId].comGwSrcEndByte)
/* DL201434 */
#define COM_CFG_GWSRCDESC_LSBPOS(GwSourceDescId)            (Com_SrcDescPB[GwSourceDescId].comGwSrcLSBPos)
#define COM_CFG_GWSRCDESC_MSBPOS(GwSourceDescId)            (Com_SrcDescPB[GwSourceDescId].comGwSrcMSBPos)
/* DL201434 */
#define COM_CFG_GWSRCDESC_IPDUIDREF(GwSourceDescId)         (Com_SrcDescPB[GwSourceDescId].comGwSrcIPduRefIndex)

#define COM_CFG_GWDESTDESC_FLAG(GwDestDescId)               (Com_DestDescPB[GwDestDescId].comGwDestFlag)
/* DL201434 */
#define COM_CFG_GWDESTDESC_LSBPOS(GwDestDescId)             (Com_DestDescPB[GwDestDescId].comGwDestLSBPos)
#define COM_CFG_GWDESTDESC_MSBPOS(GwDestDescId)             (Com_DestDescPB[GwDestDescId].comGwDestMSBPos)
/* DL201434 */
#define COM_CFG_GWDESTDESC_VALUEINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comGwDestBufIndex)
#define COM_CFG_GWDESTDESC_IPDUIDREF(GwDestDescId)          (Com_DestDescPB[GwDestDescId].comGwDestIPduRefIndex)

#define COM_CFG_SIGGWMAP_SRCID(SignalGwMapIndex)               (Com_SignalGwMapPB[SignalGwMapIndex].comGwSrcIndex)
#define COM_CFG_SIGGWMAP_DESTINDEXSTART(SignalGwMapIndex)      (Com_SignalGwMapPB[SignalGwMapIndex].comGwDestIndexStart)
/* DL201425 */
#define COM_CFG_SIGGWMAP_DESTINDEXSTOP(SignalGwMapIndex)             (Com_SignalGwMapPB[SignalGwMapIndex].comGwDestIndexStop)

#define COM_CFG_SIGGRPGWMAP_SRCID(SignalGroupGwMapIndex)               (Com_SGroupGwMapPB[SignalGroupGwMapIndex].comGwSrcIndex)
#define COM_CFG_SIGGRPGWMAP_DESTINDEXSTART(SignalGroupGwMapIndex)      (Com_SGroupGwMapPB[SignalGroupGwMapIndex].comGwDestIndexStart)
/* DL201425 */
#define COM_CFG_SIGGRPGWMAP_DESTINDEXSTOP(SignalGroupGwMapIndex)       (Com_SGroupGwMapPB[SignalGroupGwMapIndex].comGwDestIndexStop)

/* DL201438 */
#define COM_CFG_GWRXGRPSIGMAPTO_TXGRPSIGID(Index)                         (Com_GwMapRxGrpSigToTxGrpSigIdPB[Index])
#define COM_CFG_GWRXGSMAPTXGSIDARRAY_START(RxGroupSignalId)               (Com_RxGroupSignalPB[RxGroupSignalId].comGwMapToTxGrpSigIdStartIndex)
#define COM_CFG_GWRXGSMAPTXGSIDARRAY_STOP(RxGroupSignalId)                (Com_RxGroupSignalPB[RxGroupSignalId].comGwMapToTxGrpSigIdStopIndex)
/* DL201438 */
#endif    /* end of STD_ON == COM_GATEWAY_ENABLE */


#if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))
#define COM_CFG_GWSRCDESC_UPDATEBITPOS(GwSourceDescId)         (Com_SrcDescPB[GwSourceDescId].comGwSrcUpdateBitPos)
#define COM_CFG_GWDESTDESC_UPDATEBITPOS(GwDestDescId)          (Com_DestDescPB[GwDestDescId].comGwDestUpdateBitPos)
#endif  /* end of (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE) */


/* DL201429 */
#if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
/* DL201444 */
#define COM_CONST_DESTDESCRIPTMCSRT_NUM    (COM_DESTDESCRIPTION_TMCRST_NUMBER)
/* DL201444 */

#define COM_CFG_GWDESTDESC_FILTERFUNCINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comFilterFuncIndex)
#define COM_CFG_GWDESTDESC_FILTERPARAINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comFilterIndex)
#define COM_CFG_GWDESTDESC_FTMCINDEX(GwDestDescId)               (Com_DestDescPB[GwDestDescId].comTMCIndex)
#define COM_CFG_GWDESTDESC_FOCCURENCEINDEX(GwDestDescId)         (Com_DestDescPB[GwDestDescId].comFilterOccurceIndex)

/* DL201442 */
#define COM_CFG_GWDESTDESC_INITTMC(GwDestDescTMCIndex)           (Com_DestDescripInitTMC[GwDestDescTMCIndex])
/* DL201442 */
#endif  /* end of (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE) */

#if (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))      \
     || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE)))
#define COM_CFG_GWDESTDESC_IDSTART(TxIPduId)                     (Com_TxIPduPB[TxIPduId].comDestDescripStart)
#define COM_CFG_GWDESTDESC_IDSTOP(TxIPduId)                      (Com_TxIPduPB[TxIPduId].comDestDescripStop)
#endif
/* (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
     || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))) */
/* DL201429 */


#if (STD_ON == COM_DEV_ERROR_DETECT)
#define COM_RXSIGNALNUM                        (COM_RXSIGNAL_NUMBER)
#define COM_TXSIGNALNUM                        (COM_TXSIGNAL_NUMBER)
#define COM_RXSIGNALGROUPNUM                   (COM_RXSIGNALGROUP_NUMBER)
#define COM_TXSIGNALGROUPNUM                   (COM_TXSIGNALGROUP_NUMBER)
#define COM_RXGROUPSIGNALNUM                   (COM_RXGROUPSIGNAL_NUMBER)
#define COM_TXGROUPSIGNALNUM                   (COM_TXGROUPSIGNAL_NUMBER)
#endif

#endif    /* end of COM_VARIANT_PC == COM_VARIANT_CFG */

/* DL201443 */
/*============================================================================*/
#if (COM_VARIANT_PB == COM_VARIANT_CFG)
#define COM_PTR_TXMODE(TxModeIndex)        (Com_ConfigStd->comTxMode[TxModeIndex])
#define COM_PTR_IPDUGROUPPB(IPduGroupId)   (Com_ConfigStd->comIPduGroupPB[IPduGroupId])
#define COM_PTR_RXIPDUPB(RxIPduId)         (Com_ConfigStd->comRxIPduPB[RxIPduId])
#define COM_PTR_TXIPDUPB(TxIPduId)         (Com_ConfigStd->comTxIPduPB[TxIPduId])
#define COM_PTR_RXSIGNALPB(RxSignalId)     (Com_ConfigStd->comRxSignalPB[RxSignalId])
#define COM_PTR_TXSIGNALPB(TxSignalId)     (Com_ConfigStd->comTxSignalPB[TxSignalId])
#define COM_PTR_RXSIGGRPPB(RxSignalGroupId)  (Com_ConfigStd->comRxSignalGroupPB[RxSignalGroupId])
#define COM_PTR_TXSIGGRPPB(TxSignalGroupId)  (Com_ConfigStd->comTxSignalGroupPB[TxSignalGroupId])
#define COM_PTR_RXGRPSIGPB(RxGroupSignalId)  (Com_ConfigStd->comRxGroupSignalPB[RxGroupSignalId])
#define COM_PTR_TXGRPSIGPB(TxGroupSignalId)  (Com_ConfigStd->comTxGroupSignalPB[TxGroupSignalId])

#define COM_CFG_TXMODE_IND_TRUE(TxModeIndex)               (Com_ConfigStd->comTxMode[TxModeIndex].comTxMode)
#define COM_CFG_TXMODE_IND_TRUE_N(TxModeIndex)             (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_IND_TRUE_NTCNTR(TxModeIndex)        (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_IND_TRUE_OFFSETCNTR(TxModeIndex)        (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_IND_TRUE_PERIODCNTR(TxModeIndex)        (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeTimePeriod)

#if (STD_ON == COM_GATEWAY_ENABLE)
#define COM_PTR_GWSRCDESCPB(GwSrcDescripId)    (Com_ConfigStd->comGwSrcDescPB[GwSrcDescripId])
#define COM_PTR_GWDESTDESCPB(GwDestDescripId)  (Com_ConfigStd->comGwDestDescPB[GwDestDescripId])
#define COM_PTR_GWSIGNALMAP(GwSignalMapId)     (Com_ConfigStd->comSignalGwMapPB[GwSignalMapId])
#define COM_PTR_GWSIGGRPMAP(GwSigGrpMapId)     (Com_ConfigStd->comSignalGroupGwMapPB[GwSigGrpMapId])
#endif    /* STD_ON == COM_GATEWAY_ENABLE */

#if (STD_ON == COM_FILTER_ENABLE)
#define COM_CFG_TXMODE_IND_FALSE(TxModeIndex)              (Com_ConfigStd->comTxMode[TxModeIndex].comTxMode)
#define COM_CFG_TXMODE_IND_FALSE_N(TxModeIndex)            (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_IND_FALSE_NTCNTR(TxModeIndex)       (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_IND_FALSE_OFFSETCNTR(TxModeIndex)       (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_IND_FALSE_PERIODCNTR(TxModeIndex)       (Com_ConfigStd->comTxMode[TxModeIndex].comTxModeTimePeriod)
#endif    /* STD_ON == COM_FILTER_ENABLE */

#endif    /* COM_VARIANT_PB == COM_VARIANT_CFG */

#if (COM_VARIANT_LT == COM_VARIANT_CFG)
#define COM_PTR_TXMODE(TxModeIndex)        (Com_TxMode[TxModeIndex])
#define COM_PTR_IPDUGROUPPB(IPduGroupId)   (Com_IPduGroupPB[IPduGroupId])
#define COM_PTR_RXIPDUPB(RxIPduId)         (Com_RxIPduPB[RxIPduId])
#define COM_PTR_TXIPDUPB(TxIPduId)         (Com_TxIPduPB[TxIPduId])
#define COM_PTR_RXSIGNALPB(RxSignalId)     (Com_RxSignalPB[RxSignalId])
#define COM_PTR_TXSIGNALPB(TxSignalId)     (Com_TxSignalPB[TxSignalId])
#define COM_PTR_RXSIGGRPPB(RxSignalGroupId)  (Com_RxSignalGroupPB[RxSignalGroupId])
#define COM_PTR_TXSIGGRPPB(TxSignalGroupId)  (Com_TxSignalGroupPB[TxSignalGroupId])
#define COM_PTR_RXGRPSIGPB(RxGroupSignalId)  (Com_RxGroupSignalPB[RxGroupSignalId])
#define COM_PTR_TXGRPSIGPB(TxGroupSignalId)  (Com_TxGroupSignalPB[TxGroupSignalId])

#define COM_CFG_TXMODE_IND_TRUE(TxModeIndex)               (Com_TxMode[TxModeIndex].comTxMode)
#define COM_CFG_TXMODE_IND_TRUE_N(TxModeIndex)             (Com_TxMode[TxModeIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_IND_TRUE_NTCNTR(TxModeIndex)        (Com_TxMode[TxModeIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_IND_TRUE_OFFSETCNTR(TxModeIndex)        (Com_TxMode[TxModeIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_IND_TRUE_PERIODCNTR(TxModeIndex)        (Com_TxMode[TxModeIndex].comTxModeTimePeriod)

#if (STD_ON == COM_GATEWAY_ENABLE)
#define COM_PTR_GWSRCDESCPB(GwSrcDescripId)    (Com_SrcDescPB[GwSrcDescripId])
#define COM_PTR_GWDESTDESCPB(GwDestDescripId)  (Com_DestDescPB[GwDestDescripId])
#define COM_PTR_GWSIGNALMAP(GwSignalMapId)     (Com_SignalGwMapPB[GwSignalMapId])
#define COM_PTR_GWSIGGRPMAP(GwSigGrpMapId)     (Com_SGroupGwMapPB[GwSigGrpMapId])
#endif    /* STD_ON == COM_GATEWAY_ENABLE */

#if (STD_ON == COM_FILTER_ENABLE)
#define COM_CFG_TXMODE_IND_FALSE(TxModeIndex)              (Com_TxMode[TxModeIndex].comTxMode)
#define COM_CFG_TXMODE_IND_FALSE_N(TxModeIndex)            (Com_TxMode[TxModeIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_IND_FALSE_NTCNTR(TxModeIndex)       (Com_TxMode[TxModeIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_IND_FALSE_OFFSETCNTR(TxModeIndex)       (Com_TxMode[TxModeIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_IND_FALSE_PERIODCNTR(TxModeIndex)       (Com_TxMode[TxModeIndex].comTxModeTimePeriod)
#endif    /* STD_ON == COM_FILTER_ENABLE */

#endif    /* COM_VARIANT_LT == COM_VARIANT_CFG */

#if (COM_VARIANT_PC == COM_VARIANT_CFG)
#define COM_PTR_TXMODE(TxModeIndex)        (Com_TxMode[TxModeIndex])
#define COM_PTR_IPDUGROUPPB(IPduGroupId)   (Com_IPduGroupPB[IPduGroupId])
#define COM_PTR_RXIPDUPB(RxIPduId)         (Com_RxIPduPB[RxIPduId])
#define COM_PTR_TXIPDUPB(TxIPduId)         (Com_TxIPduPB[TxIPduId])
#define COM_PTR_RXSIGNALPB(RxSignalId)     (Com_RxSignalPB[RxSignalId])
#define COM_PTR_TXSIGNALPB(TxSignalId)     (Com_TxSignalPB[TxSignalId])
#define COM_PTR_RXSIGGRPPB(RxSignalGroupId)  (Com_RxSignalGroupPB[RxSignalGroupId])
#define COM_PTR_TXSIGGRPPB(TxSignalGroupId)  (Com_TxSignalGroupPB[TxSignalGroupId])
#define COM_PTR_RXGRPSIGPB(RxGroupSignalId)  (Com_RxGroupSignalPB[RxGroupSignalId])
#define COM_PTR_TXGRPSIGPB(TxGroupSignalId)  (Com_TxGroupSignalPB[TxGroupSignalId])

#define COM_CFG_TXMODE_IND_TRUE(TxModeIndex)               (Com_TxMode[TxModeIndex].comTxMode)
#define COM_CFG_TXMODE_IND_TRUE_N(TxModeIndex)             (Com_TxMode[TxModeIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_IND_TRUE_NTCNTR(TxModeIndex)        (Com_TxMode[TxModeIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_IND_TRUE_OFFSETCNTR(TxModeIndex)        (Com_TxMode[TxModeIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_IND_TRUE_PERIODCNTR(TxModeIndex)        (Com_TxMode[TxModeIndex].comTxModeTimePeriod)

#if (STD_ON == COM_GATEWAY_ENABLE)
#define COM_PTR_GWSRCDESCPB(GwSrcDescripId)    (Com_SrcDescPB[GwSrcDescripId])
#define COM_PTR_GWDESTDESCPB(GwDestDescripId)  (Com_DestDescPB[GwDestDescripId])
#define COM_PTR_GWSIGNALMAP(GwSignalMapId)     (Com_SignalGwMapPB[GwSignalMapId])
#define COM_PTR_GWSIGGRPMAP(GwSigGrpMapId)     (Com_SGroupGwMapPB[GwSigGrpMapId])
#endif    /* STD_ON == COM_GATEWAY_ENABLE */

#if (STD_ON == COM_FILTER_ENABLE)
#define COM_CFG_TXMODE_IND_FALSE(TxModeIndex)              (Com_TxMode[TxModeIndex].comTxMode)
#define COM_CFG_TXMODE_IND_FALSE_N(TxModeIndex)            (Com_TxMode[TxModeIndex].comTxModeNumOfRepeat)
#define COM_CFG_TXMODE_IND_FALSE_NTCNTR(TxModeIndex)       (Com_TxMode[TxModeIndex].comTxModeRepeatPeriod)
#define COM_CFG_TXMODE_IND_FALSE_OFFSETCNTR(TxModeIndex)       (Com_TxMode[TxModeIndex].comTxModeTimeOffset)
#define COM_CFG_TXMODE_IND_FALSE_PERIODCNTR(TxModeIndex)       (Com_TxMode[TxModeIndex].comTxModeTimePeriod)
#endif    /* STD_ON == COM_FILTER_ENABLE */


#endif    /* COM_VARIANT_PC == COM_VARIANT_CFG */

/*============================================================================*/
/* DL201443 */


/*=======[T Y P E   D E F I N I T I O N S]====================================*/
/* DL201419 */
#if (STD_ON == COM_FILTER_ENABLE)
typedef P2FUNC(boolean, COM_APPL_CODE, Com_FilterFunctionType) (uint32 newValue, Com_SignalIdType signalId);
/* DL201419 */
#endif    /* STD_ON == COM_FILTER_ENABLE */

typedef struct
{
    boolean signalChanged;  /* sending signal changed? */
    boolean tmChanged;      /* TM changed? */ 
    uint8 ipduTxMode;       /* Ipdu Tx Mode. */
    uint8 rptNum;           /* The N of N-Times parameter in Mix or Direct IPDU. */
    uint16 PeriodCntr;      /* Cycle counter parameter in Mix or Period IPDU. */
    uint16 NTimeCntr;       /* The N counter parameter of N-Times  Mix or Direct IPDU. */
}IpduHandlePrmType;


/*=======[M A C R O   F U N C T I O N]========================================*/
#define Com_GetBitFrm8ByteArr(IpduBuff, BitPos) ((((IpduBuff)[(BitPos) >> 3u])>>((BitPos) & 0x07u)) & 0x01u)

#define Com_SetBitTo8ByteArr(IpduBuff, BitPos) ((IpduBuff)[(BitPos) >> 3u]=((IpduBuff)[(BitPos) >> 3u]) | ((uint8)(0x01u << ((BitPos) & 0x07u))))

#define Com_ClrBitFrm8ByteArr(IpduBuff, BitPos) ((IpduBuff)[(BitPos) >> 3u]=((IpduBuff)[(BitPos) >> 3u]) & ((uint8)(~(0x01u << ((BitPos) & 0x07u)))))

#define Com_GetFlagState(Flag,Mask) ((Flag) & (Mask))

#define Com_SetFlagState(Flag,Mask) ((Flag) |= (Mask))

#define Com_ClearFlagState(Flag,Mask) ((Flag) &= (~(Mask)))

/* clear all updatebits of one IPdu */
/* DL201422 */
/* DL201418 */
#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define Com_ClearUpdatesInTxIPduMF(txiPduPbPtr)                                                            \
{                                                                                                     \
    uint16 updateSignalorGroupId = 0u;                                                                \
                                                                                                      \
    /* DL201425 */                                                                                    \
    for(updateSignalorGroupId = (txiPduPbPtr)->comSignalIndexStart;                                 \
        updateSignalorGroupId <= (txiPduPbPtr)->comSignalIndexStop;                                 \
        updateSignalorGroupId++)                                                                      \
    {                                                                                                 \
        if(COM_INDEX_DEFAULT !=                                                                       \
            COM_PTR_TXSIGNALPB(COM_CFG_TXSIGNAL_ID(updateSignalorGroupId)).comSignalUpdateBitPos)                \
        {                                                                                             \
            Com_ClrBitFrm8ByteArr(                                                                    \
                (&(Com_TxIPduRuntimeBuff[(txiPduPbPtr)->comTxIPduBufIndex]))                          \
                ,(COM_PTR_TXSIGNALPB(COM_CFG_TXSIGNAL_ID(updateSignalorGroupId)).comSignalUpdateBitPos) );       \
        }                                                                                             \
    }                                                                                                 \
                                                                                                      \
    /* DL201425 */                                                                                    \
    for(updateSignalorGroupId = (txiPduPbPtr)->comSignalGroupIndexStart;                            \
        updateSignalorGroupId <= (txiPduPbPtr)->comSignalGroupIndexStop;                            \
        updateSignalorGroupId++)                                                                      \
    {                                                                                                 \
        if(COM_INDEX_DEFAULT !=                                                                       \
            COM_PTR_TXSIGGRPPB(COM_CFG_TXSIGNALGROUP_ID(updateSignalorGroupId)).comUpdateBitPos)           \
        {                                                                                             \
            Com_ClrBitFrm8ByteArr(                                                                    \
                (&(Com_TxIPduRuntimeBuff[(txiPduPbPtr)->comTxIPduBufIndex]))                          \
                ,(COM_PTR_TXSIGGRPPB(COM_CFG_TXSIGNALGROUP_ID(updateSignalorGroupId)).comUpdateBitPos) );  \
        }                                                                                             \
    }                                                                                                 \
}                                                                                                     \
/* DL201422 */
/* DL201418 */
#endif    /* STD_ON == COM_UPDATEBIT_ENABLE */


/* DL201404 */
/* TxSignal & TxSignalGroup DM Timeout Notification of this IPdu */
#define Com_TxDMTOutNotifMF(txIPduPbPtr)                                                                            \
{                                                                                                                                       \
    uint16 txNotifLoop;                                                                                                           \
                                                                                                                                         \
    /* DL201425 */                                                                                                               \
    /* Loop All Tx_Singal to TOutNotification */                                                                          \
    for(txNotifLoop = (txIPduPbPtr)->comSignalIndexStart;                                           \
        txNotifLoop <= (txIPduPbPtr)->comSignalIndexStop; txNotifLoop++)                      \
    {                                                                                                                                    \
        /* if cfged ToutFunc */                                                                                                 \
        if(NULL_PTR != Com_TxSignalLT[COM_CFG_TXSIGNAL_ID(txNotifLoop)].comCbkTxTOutFunc) \
        {                                                                                                                                \
            Com_TxSignalLT[COM_CFG_TXSIGNAL_ID(txNotifLoop)].comCbkTxTOutFunc();                \
        }                                                                                                                                 \
    }                                                                                                                                     \
                                                                                                                                           \
    /* DL201425 */                                                                                                                 \
    /* Loop All Tx_SingalGroup to TOutNotification */                                                                    \
    for(txNotifLoop = (txIPduPbPtr)->comSignalGroupIndexStart;                                     \
        txNotifLoop <= (txIPduPbPtr)->comSignalGroupIndexStop; txNotifLoop++)                 \
    {                                                                                                                                      \
        /* if cfged ToutFunc */                                                                                                   \
        if(NULL_PTR != Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(txNotifLoop)].comSignalGroupCbkTxTOutFnc) \
        {                                                                                                                                   \
            Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(txNotifLoop)].comSignalGroupCbkTxTOutFnc();          \
        }                                                                                                                                   \
    }                                                                                                                                       \
}
/* DL201404 */

/* DL201403 */
/* TxSignal & TxSignalGroup Error Notification of this IPdu */
#define Com_TxErrorNotifMF(txIPduId)                                                              \
{                                                                                                 \
    uint16 txNotifLoop;                                                                           \
                                                                                                  \
    /* DL201425 */                                                                                \
    /* Loop All Tx_Singal to TOutNotification */                                                  \
    for(txNotifLoop = COM_CFG_TXSIGNAL_INDEX_START(txIPduId);                                     \
        txNotifLoop <= COM_CFG_TXSIGNAL_INDEX_STOP(txIPduId); txNotifLoop++)                      \
    {                                                                                             \
        /* if cfged ToutFunc */                                                                   \
        if(NULL_PTR != Com_TxSignalLT[COM_CFG_TXSIGNAL_ID(txNotifLoop)].comCbkTxErrFunc)          \
        {                                                                                         \
            Com_TxSignalLT[COM_CFG_TXSIGNAL_ID(txNotifLoop)].comCbkTxErrFunc();                   \
        }                                                                                         \
    }                                                                                             \
                                                                                                  \
    /* DL201425 */                                                                                \
    /* Loop All Tx_SingalGroup to TOutNotification */                                             \
    for(txNotifLoop = COM_CFG_TXSIGNALGROUP_INDEX_START(txIPduId);                                \
        txNotifLoop <= COM_CFG_TXSIGNALGROUP_INDEX_STOP(txIPduId); txNotifLoop++)                 \
    {                                                                                             \
        /* if cfged ToutFunc */                                                                   \
        if(NULL_PTR != Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(txNotifLoop)].comSignalGroupCbkTxErrFnc)  \
        {                                                                                                     \
            Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(txNotifLoop)].comSignalGroupCbkTxErrFnc();           \
        }                                                                                                     \
    }                                                                                                         \
}                                                                                                             \
/* DL201403 */

/* sTS: signal type string-bool or 8Bit or 16Bit or 32Bit */
/* DL201419 */
#if (STD_ON == COM_FILTER_ENABLE)
#define Com_ReplaceSignalbuff(sTSRT, sTSIV, mIsUseOB, rxSignalPbPtr)                   \
if((mIsUseOB) > 0u)                                                                  \
{                                                                                  \
    Com_RxSignalNOB##sTSRT##RtimeBuff[(rxSignalPbPtr)->comSignalBufIndex] =    \
    COM_CFG_RXSIGNOB##sTSIV##_INITVALUE((rxSignalPbPtr)->comSignalBufIndex);   \
}                                                                                  \
else                                                                               \
{                                                                                  \
    Com_Signal##sTSRT##RuntimeBuff[(rxSignalPbPtr)->comSignalBufIndex] =       \
    COM_CFG_SIGNAL##sTSIV##_INITVALUE((rxSignalPbPtr)->comSignalBufIndex);     \
} 
#else    /* If Filter Disable, there is no NOB Buffer */
#define Com_ReplaceSignalbuff(sTSRT, sTSIV, mIsUseOB, rxSignalPbPtr)                   \
    Com_Signal##sTSRT##RuntimeBuff[(rxSignalPbPtr)->comSignalBufIndex] =       \
    COM_CFG_SIGNAL##sTSIV##_INITVALUE((rxSignalPbPtr)->comSignalBufIndex);
#endif    /* STD_ON == COM_FILTER_ENABLE */
/* DL201419 */


/* sTS: signal type string-bool or 8Bit or 16Bit or 32Bit */
/* DL201419 */
#if (STD_ON == COM_FILTER_ENABLE)
#define Com_UpdateSignalBuff(sTS, mIsUseOB, rxSignalPbPtr, mSignalV)                              \
if((mIsUseOB) > 0u)                                                                                                           \
{                                                                                                                                       \
    Com_RxSignalNOB##sTS##RtimeOldBuff[(rxSignalPbPtr)->comSignalBufIndex] = (mSignalV);        \
    Com_RxSignalNOB##sTS##RtimeBuff[(rxSignalPbPtr)->comSignalBufIndex] = (mSignalV);            \
}                                                                                                                                      \
else                                                                                                                                  \
{                                                                                                                                      \
    Com_Signal##sTS##RuntimeBuff[(rxSignalPbPtr)->comSignalBufIndex] = (mSignalV);                \
}
#else    /* If Filter Disable, there is no NOB Buffer */
#define Com_UpdateSignalBuff(sTS, mIsUseOB, rxSignalPbPtr, mSignalV)                             \
    Com_Signal##sTS##RuntimeBuff[(rxSignalPbPtr)->comSignalBufIndex] = (mSignalV);
#endif    /* STD_ON == COM_FILTER_ENABLE */
/* DL201419 */


#define Com_RxSignalBuffHanlde(mIsUseOB, rxSignalPbPtr, mSignalV)                                         \
switch(Com_GetFlagState((rxSignalPbPtr)->comSignalPBFlag, COM_PBRXSIGNALTYPE_MASK))                \
{                                                                                                                                               \
    case COM_RXSIGNAL_TYPE_BOOLEAN:                                                                                         \
        Com_UpdateSignalBuff(Bool, (mIsUseOB), (rxSignalPbPtr), ((boolean)(mSignalV)));                    \
        break;                                                                                                                                \
                                                                                                                                                 \
    case COM_RXSIGNAL_TYPE_SINT8:                                                                                              \
    case COM_RXSIGNAL_TYPE_UINT8:                                                                                              \
        Com_UpdateSignalBuff(8Bit, (mIsUseOB), (rxSignalPbPtr), ((uint8)(mSignalV)));                       \
        break;                                                                                                                                \
                                                                                                                                                 \
    case COM_RXSIGNAL_TYPE_SINT16:                                                                                            \
    case COM_RXSIGNAL_TYPE_UINT16:                                                                                            \
        Com_UpdateSignalBuff(16Bit, (mIsUseOB), (rxSignalPbPtr), ((uint16)(mSignalV)));                    \
        break;                                                                                                                                \
                                                                                                                                                  \
    case COM_RXSIGNAL_TYPE_UINT32:                                                                                             \
    case COM_RXSIGNAL_TYPE_SINT32:                                                                                             \
        Com_UpdateSignalBuff(32Bit, (mIsUseOB), (rxSignalPbPtr), ((uint32)(mSignalV)));                     \
        break;                                                                                                                                 \
                                                                                                                                                  \
    default:                                                                                                                                   \
        break;                                                                                                                                 \
}


#define Com_RxSignalReplaceHanlde(mIsUseOB, mSignalID, rxSignalPbPtr)                                              \
switch(Com_GetFlagState((rxSignalPbPtr)->comSignalPBFlag, COM_PBRXSIGNALTYPE_MASK))              \
{                                                                                                   \
    case COM_RXSIGNAL_TYPE_BOOLEAN:                                                                     \
        Com_ReplaceSignalbuff(Bool, BOOL, mIsUseOB, (rxSignalPbPtr));                                         \
        break;                                                                                          \
                                                                                                        \
    case COM_RXSIGNAL_TYPE_SINT8:                                                                       \
    case COM_RXSIGNAL_TYPE_UINT8:                                                                       \
        Com_ReplaceSignalbuff(8Bit, 8BIT, mIsUseOB, (rxSignalPbPtr));                                         \
        break;                                                                                          \
                                                                                                        \
    case COM_RXSIGNAL_TYPE_SINT16:                                                                      \
    case COM_RXSIGNAL_TYPE_UINT16:                                                                      \
        Com_ReplaceSignalbuff(16Bit, 16BIT, mIsUseOB, (rxSignalPbPtr));                                       \
        break;                                                                                          \
                                                                                                        \
    case COM_RXSIGNAL_TYPE_UINT32:                                                                      \
    case COM_RXSIGNAL_TYPE_SINT32:                                                                      \
        Com_ReplaceSignalbuff(32Bit, 32BIT, mIsUseOB, (rxSignalPbPtr));                                       \
        break;                                                                                          \
                                                                                                        \
    default:                                                                                            \
        break;                                                                                          \
}

/* SW201411 */
/* DL201418 */
#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define GetSignalUpdatebit(rxSignalPbPtr, mPduInfoPtr)     \
    Com_GetBitFrm8ByteArr(mPduInfoPtr \
    ,(rxSignalPbPtr)->comSignalUpdateBitPos)
/* DL201418 */
#endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

/* DL201418 */
#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define GetSignalGrpUpdatebit(mSignalGroupID, mPduInfoPtr)    \
    Com_GetBitFrm8ByteArr((mPduInfoPtr)                                  \
    ,COM_CFG_RXSIGGRP_UPDATEBITPOS(mSignalGroupID))
/* DL201418 */
#endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
/* SW201411 */

#if (STD_ON == COM_GATEWAY_ENABLE)
/* SW201410 */
#if (STD_ON == COM_UPDATEBIT_ENABLE)
#define GetRxDescUpdatebit(mSignalID, mPduInfoPtr)     \
    Com_GetBitFrm8ByteArr((mPduInfoPtr)                       \
    ,COM_CFG_GWSRCDESC_UPDATEBITPOS(mSignalID))
#endif
/* SW201410 */
#endif

/* sTS: signal type string-bool or 8Bit or 16Bit or 32Bit */
#define Com_ReplaceGrpSignalbuff(sTSRT, sTSIV, ValInd)             \
       (Com_RxGroupSignal##sTSRT##RtimeBuff[ValInd]                 \
       = COM_CFG_RXGRPSIG##sTSIV##_INITVALUE(ValInd))

/* sTS: signal type string-bool or 8Bit or 16Bit or 32Bit */
#define Com_UpdateGrpSignalBuffM(sTS, mGrpSignalID, mGrpSignalV)                                \
       (Com_RxGroupSignal##sTS##RtimeBuff[COM_CFG_RXGRPSIG_VALUEINDEX(mGrpSignalID)] = (mGrpSignalV))
                                                                                   
/* sTS: signal type string-bool or 8Bit or 16Bit or 32Bit */
#define Com_RecoverGrpSignalbuff(sTS,  ValInd)              \
       (Com_RxGroupSignal##sTS##RtimeBuff[ ValInd] =         \
       Com_RxShadowSignal##sTS##RTimeBuff[ ValInd])

#if(STD_ON == COM_UPDATEBIT_ENABLE)
#define Com_HandleDescUpdateBit(DestDescId, TxMode, rptNumber)                                                                               \
    if(COM_INDEX_DEFAULT != (COM_CFG_GWDESTDESC_UPDATEBITPOS(DestDescId)))                                                         \
    {                                                                                                                                                                               \
        if( ((TxMode) == COM_TX_MODE_NONE) || ((TxMode) == COM_TX_MODE_PERIODIC)                                                         \
          ||( (((TxMode) == COM_TX_MODE_DIRECT)||((TxMode) != COM_TX_MODE_MIXED))                                                       \
            &&((rptNumber) <= 1u)))                                                                                                                                      \
        {                                                                                                                                                                            \
            Com_SetBitTo8ByteArr(                                                                                                                                       \
            (&(Com_TxIPduRuntimeBuff[COM_CFG_TXIPDU_BUFFINDEX(COM_CFG_GWDESTDESC_IPDUIDREF(DestDescId))]))     \
           ,(COM_CFG_GWDESTDESC_UPDATEBITPOS(DestDescId))                                                                                         \
           );                                                                                                                                                                         \
        }                                                                                                                                                                             \
    }
#endif

/* DL201418 */
#if(STD_ON == COM_UPDATEBIT_ENABLE)
#define Com_HandleSignalUpdateBit(signalId, TxMode, rptNumber)                                                 \
    if(COM_INDEX_DEFAULT != (COM_CFG_TXSIGNAL_UPDATEBITPOS(signalId)))                                    \
    {                                                                                                      \
        if( ((TxMode) == COM_TX_MODE_NONE) || ((TxMode) == COM_TX_MODE_PERIODIC)                        \
          ||( (((TxMode) == COM_TX_MODE_DIRECT)||((TxMode) != COM_TX_MODE_MIXED))                         \
            &&((rptNumber) <= 1u)))                                                                        \
        {                                                                                                   \
            Com_SetBitTo8ByteArr(                                                                          \
            (&(Com_TxIPduRuntimeBuff[COM_CFG_TXIPDU_BUFFINDEX(COM_CFG_TXSIGNAL_IPDUIDREF(signalId))]))    \
           ,(COM_CFG_TXSIGNAL_UPDATEBITPOS(signalId))                                                     \
           );                                                                                              \
        }                                                                                                   \
    }
/* DL201418 */
#endif

/* DL201418 */
#if(STD_ON == COM_UPDATEBIT_ENABLE)
#define Com_HandleSigGrpUpdateBit(sigGrpId, TxMode ,rptNumber)                                             \
if(COM_INDEX_DEFAULT != (COM_CFG_TXSIGGRP_UPDATEBITPOS(sigGrpId)))                                          \
{                                                                                                            \
    if( ((TxMode) == COM_TX_MODE_NONE) || ((TxMode) == COM_TX_MODE_PERIODIC)                             \
      ||( (((TxMode) == COM_TX_MODE_DIRECT)||((TxMode) != COM_TX_MODE_MIXED))                              \
        &&((rptNumber) <= 1u)))                                                                             \
    {                                                                                                        \
        Com_SetBitTo8ByteArr(                                                                               \
        (&(Com_TxIPduRuntimeBuff[COM_CFG_TXIPDU_BUFFINDEX(COM_CFG_TXSIGNALGROUP_IPDUIDREF(sigGrpId))]))    \
       ,(COM_CFG_TXSIGGRP_UPDATEBITPOS(sigGrpId))                                                          \
       );                                                                                                   \
    }                                                                                                        \
}
/* DL201418 */
#endif

/* DL201435 */
#define Com_TxSetSignalBuff(signalPBPtr, NewValue, Rst)                                                                        \
switch(Com_GetFlagState(((signalPBPtr)->comSignalPBFlag),COM_PBTXSIGNALTYPE_MASK))                                \
{                                                                                                                                                           \
    case COM_TXSIGNAL_TYPE_BOOLEAN:                                                                                                     \
        if(*((boolean*)(NewValue)) != Com_SignalBoolRuntimeBuff[(signalPBPtr)->comSignalBufIndex])             \
        {                                                                                                                                                    \
            Com_SignalBoolRuntimeBuff[(signalPBPtr)->comSignalBufIndex] =  *((boolean*)(NewValue));               \
            (Rst) = TRUE;                                                                                                                               \
        }                                                                                                                                                    \
        break;                                                                                                                                            \
                                                                                                                                                              \
    case COM_TXSIGNAL_TYPE_SINT8:                                                                                                          \
    case COM_TXSIGNAL_TYPE_UINT8:                                                                                                          \
        if(*((uint8*)(NewValue)) != Com_Signal8BitRuntimeBuff[(signalPBPtr)->comSignalBufIndex])                  \
        {                                                                                                                                                     \
            Com_Signal8BitRuntimeBuff[(signalPBPtr)->comSignalBufIndex] =  *((uint8*)(NewValue));                    \
            (Rst) = TRUE;                                                                                                                                \
        }                                                                                                                                                     \
        break;                                                                                                                                             \
                                                                                                                                                               \
    case COM_TXSIGNAL_TYPE_SINT16:                                                                                                          \
    case COM_TXSIGNAL_TYPE_UINT16:                                                                                                          \
        if(*((uint16*)(NewValue)) != Com_Signal16BitRuntimeBuff[(signalPBPtr)->comSignalBufIndex])                \
        {                                                                                                                                                      \
            Com_Signal16BitRuntimeBuff[(signalPBPtr)->comSignalBufIndex] =  *((uint16*)(NewValue));                  \
            (Rst) = TRUE;                                                                                                                                 \
        }                                                                                                                                                      \
        break;                                                                                                                                              \
                                                                                                                                                                \
    case COM_TXSIGNAL_TYPE_UINT32:                                                                                                           \
    case COM_TXSIGNAL_TYPE_SINT32:                                                                                                           \
        if(*((uint32*)(NewValue)) != Com_Signal32BitRuntimeBuff[(signalPBPtr)->comSignalBufIndex])                 \
        {                                                                                                                                                       \
            Com_Signal32BitRuntimeBuff[(signalPBPtr)->comSignalBufIndex] =  *((uint32*)(NewValue));                   \
            (Rst) = TRUE;                                                                                                                                  \
        }                                                                                                                                                        \
        break;                                                                                                                                                \
                                                                                                                                                                 \
    default:                                                                                                                                                  \
        break;                                                                                                                                                \
}
/* DL201435 */

/* SW201412 */
#if(STD_ON == COM_GATEWAY_ENABLE)
#define Com_DescDestBuffSet(DscID, DscValInd, NewValue, Rst)                                                    \
switch(Com_GetFlagState(COM_CFG_GWDESTDESC_FLAG(DscID),COM_PBTXSIGNALTYPE_MASK))        \
{                                                                                                                                                 \
    case COM_TXSIGNAL_TYPE_BOOLEAN:                                                                                           \
        if(*((boolean*)(NewValue)) != Com_SignalBoolRuntimeBuff[(DscValInd)])                                 \
        {                                                                                                                                          \
            Com_SignalBoolRuntimeBuff[DscValInd] =  *((boolean*)(NewValue));                                   \
            (Rst) = TRUE;                                                                                                                     \
        }                                                                                                                                           \
        break;                                                                                                                                   \
                                                                                                                                                    \
    case COM_TXSIGNAL_TYPE_SINT8:                                                                                                \
    case COM_TXSIGNAL_TYPE_UINT8:                                                                                                \
        if(*((uint8*)(NewValue)) != Com_Signal8BitRuntimeBuff[(DscValInd)])                                      \
        {                                                                                                                                           \
            Com_Signal8BitRuntimeBuff[DscValInd] =  *((uint8*)(NewValue));                                        \
            (Rst) = TRUE;                                                                                                                     \
        }                                                                                                                                           \
        break;                                                                                                                                   \
                                                                                                                                                    \
    case COM_TXSIGNAL_TYPE_SINT16:                                                                                               \
    case COM_TXSIGNAL_TYPE_UINT16:                                                                                               \
        if(*((uint16*)(NewValue)) != Com_Signal16BitRuntimeBuff[(DscValInd)])                                   \
        {                                                                                                                                           \
            Com_Signal16BitRuntimeBuff[DscValInd] =  *((uint16*)(NewValue));                                     \
            (Rst) = TRUE;                                                                                                                      \
        }                                                                                                                                           \
        break;                                                                                                                                   \
                                                                                                                                                     \
    case COM_TXSIGNAL_TYPE_UINT32:                                                                                               \
    case COM_TXSIGNAL_TYPE_SINT32:                                                                                               \
        if(*((uint32*)(NewValue)) != Com_Signal32BitRuntimeBuff[(DscValInd)])                                   \
        {                                                                                                                                           \
            Com_Signal32BitRuntimeBuff[DscValInd] =  *((uint32*)(NewValue));                                     \
            (Rst) = TRUE;                                                                                                                      \
        }                                                                                                                                           \
        break;                                                                                                                                   \
                                                                                                                                                     \
    default:                                                                                                                                     \
        break;                                                                                                                                   \
}
#endif
/* SW201412 */

/* SW201414 */
#define Com_GetTMParamWithTMSRst(txIpduID, rstObj)                          \
/* according to TMS result, getting TM, N-Times N, N-Times timer, PT. */              \
if((Com_TxIPduRTimeState[(txIpduID)].txTMSCntr) > 0u)                         \
{/* TMS==TRUE */                                                            \
     (rstObj).ipduTxMode = COM_CFG_TXMODE_TRUE(txIpduID);                   \
     (rstObj).rptNum = COM_CFG_TXMODE_TRUE_N(txIpduID);                     \
     (rstObj).PeriodCntr = COM_CFG_TXMODE_TRUE_PERIODCNTR(txIpduID);        \
     (rstObj).NTimeCntr = COM_CFG_TXMODE_TRUE_NTCNTR(txIpduID);             \
}                                                                           \
else if(0u == (Com_TxIPduRTimeState[(txIpduID)].txTMSCntr))                   \
{/* TMS==FALSE */                                                           \
     (rstObj).ipduTxMode = COM_CFG_TXMODE_FALSE(txIpduID);                  \
     (rstObj).rptNum = COM_CFG_TXMODE_FALSE_N(txIpduID);                    \
     (rstObj).PeriodCntr = COM_CFG_TXMODE_FALSE_PERIODCNTR(txIpduID);       \
     (rstObj).NTimeCntr = COM_CFG_TXMODE_FALSE_NTCNTR(txIpduID);            \
}else{}                                                                     
/* SW201414 */

#define Com_SignalRxNotif(rxSignalLtPtr)                 \
if(NULL_PTR != ((rxSignalLtPtr)->comCbkRxAckFunc))      \
{                                                                            \
    (rxSignalLtPtr)->comCbkRxAckFunc();                       \
}                                                                       

/* DL201418 */
#if(STD_ON == COM_UPDATEBIT_ENABLE)
#define Com_InitRxSignalDM(rxSignalLtPtr, updateBitStat, dmSwtch)         \
if(((updateBitStat)>0) && (COM_INDEX_DEFAULT != (dmSwtch)))                  \
{                                                                                                            \
    Com_RxUpdateSignalRTimeDMCntr[dmSwtch] =                                    \
    (rxSignalLtPtr)->comSignalDMTOut;                                                          \
}
/* DL201418 */
#endif

#define Com_SignalRxInvNotif(rxSignalLtPtr)            \
if(NULL_PTR != ((rxSignalLtPtr)->comCbkRxInvFunc))      \
{                                                                            \
    (rxSignalLtPtr)->comCbkRxInvFunc();                        \
} 

/* DL201431 */
#define Com_Update8NSignalBuff(rxDataPtr, Counter, signalSize, signalbuffInd, SignalPosInPdu, signalEndianess)   \
if(COM_RXSIGNAL_ENDIANESS_BIG == (signalEndianess))                                                                \
{                                                                                                                \
    for((Counter) = 0u; (Counter) < (signalSize); (Counter)++)                                                           \
    {                                                                                                            \
        Com_Signal8BitRuntimeBuff[(signalbuffInd) - (Counter)] = (rxDataPtr)[(SignalPosInPdu) + (Counter)];                \
    }                                                                                                            \
}                                                                                                                \
else                                                                                                             \
{                                                                                                                \
    for((Counter) = 0u; (Counter) < (signalSize); (Counter)++)                                                           \
    {                                                                                                            \
        Com_Signal8BitRuntimeBuff[(signalbuffInd) + (Counter)] = (rxDataPtr)[(SignalPosInPdu) + (Counter)];                \
    }                                                                                                            \
}
/* DL201431 */

/* DL201434 */
#define Com_ToNextRxSignalByteInIPduMF(SignaFlag, RxIPduBufferPtr)                                \
if(COM_RXSIGNAL_ENDIANESS_BIG == Com_GetFlagState((SignaFlag), (COM_PBRXSIGENDIANESS_MASK)))      \
{                                                                                                 \
    (RxIPduBufferPtr)--;                                                                            \
}                                                                                                 \
else                                                                                              \
{                                                                                                 \
    (RxIPduBufferPtr)++;                                                                            \
}

#define Com_ToNextTxSignalByteInIPduMF(SignaFlag, TxIPduBufferPtr)                                \
if(COM_TXSIGNAL_ENDIANESS_BIG == Com_GetFlagState((SignaFlag), (COM_PBTXSIGENDIANESS_MASK)))      \
{                                                                                                 \
    (TxIPduBufferPtr)--;                                                                            \
}                                                                                                 \
else                                                                                              \
{                                                                                                 \
    (TxIPduBufferPtr)++;                                                                            \
}
/* DL201434 */

/*=======[I N T E R N A L   R A M  D A T A]==========================================*/
#define COM_START_SEC_VAR_POWER_ON_INIT_UNSPECIFIED
#include "Com_MemMap.h"
STATIC VAR(Com_StatusType, COM_VAR_POWER_ON_INIT) Com_Status = COM_UNINIT;
#define COM_STOP_SEC_VAR_POWER_ON_INIT_UNSPECIFIED
#include "Com_MemMap.h"

/* when IPduGroupStop, IPdu MASK this ActiveMask, if ==0, ActiveFlag of This IPdu is False */
/* H is for IPduGroupId > 31u, L is for IPduGroupId <= 31u */
#define COM_START_SEC_VAR_32BIT
#include "Com_MemMap.h"
STATIC VAR(uint32, COM_VAR) Com_IPduGroupActive[2];
#define COM_STOP_SEC_VAR_32BIT
#include "Com_MemMap.h"

#if(COM_VARIANT_PB == COM_VARIANT_CFG)
#define COM_START_SEC_VAR_UNSPECIFIED
#include "Com_MemMap.h"
STATIC P2CONST(Com_ConfigType, COM_CONST, COM_CONST_PBCFG) Com_ConfigStd;
#define COM_STOP_SEC_VAR_UNSPECIFIED
#include "Com_MemMap.h"
#endif

/*=======[I N T E R N A L   F U N C T I O N   D E C L A R A T I O N S]========*/
/* DL201434 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(uint32, COM_CODE)
Com_RxUnPack
(
    uint8 pbFlag,
    uint16 lSBPosition,
    uint16 mSBPosition,
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) rxIPduBufferPtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxPack
(
    uint8 pbFlag,
    uint16 lSBPosition,
    uint16 mSBPosition,
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) signalDataPtr,
    P2VAR(uint8, AUTOMATIC, COM_VAR) txIPduBufferPtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* DL201434 */

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxPackSignalGroup(Com_SignalGroupIdType txSignalGroupId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_U8NSignalPack
(
    Com_SignalIdType txSignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalPtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_U8NGrpSignalPack(Com_SignalIdType txSignalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


#if (STD_ON == COM_FILTER_ENABLE)
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* return IPdu TMS changed or not */
STATIC FUNC(boolean, COM_CODE)
Com_TxSignalTMSHandle
(
    Com_SignalIdType txSignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) signalValuePtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* return IPdu TMS changed or not */
STATIC FUNC(boolean, COM_CODE)
Com_TxSignalGroupTMSHandle(Com_SignalGroupIdType txSignalGroupId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* GroupSignal_TMC -> SignalGroup Coutr */
STATIC FUNC(void, COM_CODE)
Com_TxSignalGroupTMCHandle
(
    Com_SignalIdType txGroupSignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) groupSignalValuePtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* Filter Function */
STATIC FUNC(boolean, COM_CODE)
Com_FAlways(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_FNever(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFNewIsWithin(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFNewIsOutside(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFOneEveryN(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxBoolFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_Rx8BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_Rx16BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_Rx32BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFNewIsWithin(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFNewIsWithin(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFNewIsOutside(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFNewIsOutside(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFOneEveryN(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFOneEveryN(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigBoolFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSBoolFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSig8BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGS8BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSig16BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGS16BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSig32BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGS32BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_FILTER_ENABLE */

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxDMTOutCancelTx(PduIdType txIPduId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_ConfirmationProcess(const PduIdType comTxPduId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RxSubIPduGroupStart
(Com_PduGroupIdType comRxSubIPduGroupId, boolean initialize);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxSubIPduGroupStart
(Com_PduGroupIdType comTxSubIPduGroupId, boolean initialize);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RxSubIPduGroupStop(Com_PduGroupIdType comRxSubIPduGroupId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxSubIPduGroupStop(Com_PduGroupIdType comTxSubIPduGroupId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_EnableRxSubIPduGroupDM(Com_PduGroupIdType comRxSubIPduGroupId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_DisableRxSubIPduGroupDM(Com_PduGroupIdType comRxSubIPduGroupId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_MainFuncTxDirect(PduIdType iPduId, boolean mDTRun, boolean txMode);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_MainFuncTxMixed(PduIdType iPduId, boolean mDTRun, boolean txMode);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_MainFuncTxPeriod(PduIdType iPduId, boolean mDTRun
/* SW201431 */
#if (STD_ON == COM_FILTER_ENABLE)
, boolean txMode
#endif
/* SW201431 */
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* if need unpack Uint8N Signal/GroupSignal, call this Function. */
STATIC FUNC(void, COM_CODE)
Com_Rx8NSignalHandle
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) pduDataPtr, 
    Com_SignalIdType rxSignalId
    /* SW201430 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    ,uint8 updateBitStat
    #endif
    /* SW201430 */
);  
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RxSignalHandle
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) pduDataPtr, 
    Com_SignalIdType rxSignalId 
    /* SW201430 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    ,uint8 updateBitStat
    #endif
    /* SW201430 */  
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_SignalRxIndication
(
    PduIdType comRxPduId, 
    P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) pduInfoPtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_SignalGroupRxIndication
(
    Com_SignalGroupIdType ComSignalGrpId, 
    P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_SignalInvalidateHandle(uint16 signalID, uint32 signalV);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_GrpSignalInvalidateHandle
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) rxPduPtr, 
    uint16 grpSignalID, 
    uint32 signalV
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_ReplaceGrpSignalsValue(uint16 signalGrpId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_ReplaceSignalValue(uint16 signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RecoverGrpSignalsValue(uint16 signalGrpId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_UpdateGrpSignalValue
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) rxPduPtr, 
    uint16 grpSignalId, 
    uint32 unpackRslt
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201458 */
STATIC FUNC(void, COM_CODE)
Com_IpduHandleInSendSignal
(
    Com_SignalIdType signalId, 
    /* SW201415 */
    #if (STD_ON == COM_GATEWAY_ENABLE)
    boolean isDescId,
    boolean isGtwSend,
    #endif
    /* SW201415 */
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
/* SW201458 */
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201458 */
STATIC FUNC(void, COM_CODE)
Com_IpduHandleInSendSignalGrp
(
    Com_SignalGroupIdType signalGrpId,
    #if (STD_ON == COM_GATEWAY_ENABLE)
    boolean gtwSend,
    #endif
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/* DL201419, this function is only used in TMS changed, so no filter, no this function */
#if (STD_ON == COM_FILTER_ENABLE)
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_IpduHdlBefMDTForSignal
(
    /* SW201416 */
    PduIdType ipduId, 
    uint8 txPbFlag,
    /* SW201416 */
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* DL201419 */
#endif    /* STD_ON == COM_FILTER_ENABLE */

/* DL201419, this function is only used in TMS changed, so no filter, no this function */
#if (STD_ON == COM_FILTER_ENABLE)
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_IpduHdlBefMDTForSignalGrp
(
    Com_SignalGroupIdType signalGrpId, 
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* DL201419 */
#endif    /* STD_ON == COM_FILTER_ENABLE */

/* DL201429 */
#if((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFNewIsWithin(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFNewIsOutside(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFOneEveryN(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripBoolFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescrip8BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescrip16BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescrip32BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* return IPdu TMS changed or not */
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripTMSHandle
(
    Com_SignalIdType destDescriptionId,
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) signalValuePtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE) */
/* DL201429 */

/* SW201407 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void , COM_CODE)
Com_UpdateShadowSignalInternal
(
    Com_SignalIdType SignalId, 
    #if (STD_ON == COM_GATEWAY_ENABLE)   
    boolean isBigEnd,
    /* SW201448 */
    boolean isGetValFromIpduBuf,
    /* SW201448 */
    #endif
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201407 */

#if (STD_ON == COM_GATEWAY_ENABLE) 
/* SW201424 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwyDescSendHandle
(
    uint16 signalMapId,
    uint16 destObjId,
    boolean isFromDesc,
    uint32 unpackRslt
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201424 */

/* SW201425 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalSendHandle
(
    uint16 signalMapId,
    uint16 destObjId,
    boolean isFromDesc,
    uint32 unpackRslt
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201425 */

/* SW201419 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GtwDescToDesc8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201419 */

/* SW201420 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GtwDescToSignal8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201420 */

/* SW201421 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GtwSignalToDesc8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201421 */

/* SW201422 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GtwSignalToSignal8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201422 */

/* SW201426 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwyDSSrcMapHandle
(
    uint16 signalMapId
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201426 */

/* SW201427 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalGrpUpdateShadowBuff
(
    uint16 signalGrpMapId
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201427 */

/* SW201428 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalGrpSendHandle
(
    uint16 signalGrpMapId
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201428 */

/* SW201429 */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalGrpSrcMapHandle
(
    uint16 signalGrpMapId
);
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201429 */
#endif

/*=======[I N T E R N A L   C O N S T  D A T A]==========================================*/
#if (STD_ON == COM_FILTER_ENABLE)
/* filter function array */
#define COM_START_SEC_CONST_UNSPECIFIED
#include "Com_MemMap.h"
STATIC CONST(Com_FilterFunctionType, COM_CONST) 
Com_FilterFunctionArray[COM_FILTER_FUNC_NUM] = 
{
    &Com_FAlways,
    &Com_FNever,
    &Com_RxFMaskNewEquX,
    &Com_RxFMaskNewDifX,
    &Com_RxFNewIsWithin,
    &Com_RxFNewIsOutside,
    &Com_RxFOneEveryN,
    &Com_RxBoolFMaskNewDifMaskOld,
    &Com_Rx8BitFMaskNewDifMaskOld,
    &Com_Rx16BitFMaskNewDifMaskOld,
    &Com_Rx32BitFMaskNewDifMaskOld,
    &Com_TxSigFMaskNewEquX,
    &Com_TxGSFMaskNewEquX,
    &Com_TxSigFMaskNewDifX,
    &Com_TxGSFMaskNewDifX,
    &Com_TxSigFNewIsWithin,
    &Com_TxGSFNewIsWithin,
    &Com_TxSigFNewIsOutside,
    &Com_TxGSFNewIsOutside,
    &Com_TxSigFOneEveryN,
    &Com_TxGSFOneEveryN,
    &Com_TxSigBoolFMaskNewDifMaskOld,
    &Com_TxGSBoolFMaskNewDifMaskOld,
    &Com_TxSig8BitFMaskNewDifMaskOld,
    &Com_TxGS8BitFMaskNewDifMaskOld,
    &Com_TxSig16BitFMaskNewDifMaskOld,
    &Com_TxGS16BitFMaskNewDifMaskOld,
    &Com_TxSig32BitFMaskNewDifMaskOld,
    &Com_TxGS32BitFMaskNewDifMaskOld,
    /* DL201429 */
    #if(STD_ON == COM_GATEWAY_ENABLE)
    &Com_DestDescripFMaskNewEquX,
    &Com_DestDescripFMaskNewDifX,
    &Com_DestDescripFNewIsWithin,
    &Com_DestDescripFNewIsOutside,
    &Com_DestDescripFOneEveryN,
    &Com_DestDescripBoolFMaskNewDifMaskOld,
    &Com_DestDescrip8BitFMaskNewDifMaskOld,
    &Com_DestDescrip16BitFMaskNewDifMaskOld,
    &Com_DestDescrip32BitFMaskNewDifMaskOld
    #endif    /* STD_ON == COM_GATEWAY_ENABLE */
    /* DL201429 */
};
#define COM_STOP_SEC_CONST_UNSPECIFIED
#include "Com_MemMap.h"
#endif

/*=======[A P I   I M P L E M E N T A T I O N S]====================*/
/******************************************************************************/
/*
 * Brief               This service initializes internal and external interfaces
 *                     and variables of the AUTOSAR COM layer for the further
 *                     processing. After calling this function the inter-ECU
 *                     communication is still disabled.
 * ServiceId           0x01
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant
 * Param-Name[in]      Config: Pointer to the COM configuration data.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_Init(P2CONST(Com_ConfigType, AUTOMATIC, COM_CONST_PBCFG) config)
{
    uint16 cirCnt = 0;

    #if((STD_ON == COM_DEV_ERROR_DETECT) && (COM_VARIANT_PB == COM_VARIANT_CFG))
    if(NULL_PTR == config)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INIT, COM_E_PARAM);
        return ;
    }
    #endif

    #if(COM_VARIANT_PB == COM_VARIANT_CFG)
    Com_ConfigStd = config;
    #endif

    /* TxIPdu Init value, based on signal or group signal init value */
    for(cirCnt = 0; cirCnt < COM_CONST_TXIPDUBUFF_SIZE; cirCnt++)
    {
        Com_TxIPduRuntimeBuff[cirCnt] = COM_CFG_TXIPDU_INITVALUE(cirCnt);
    }

    /* RxIPdu Init value, based on signal or group signal init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXIPDUBUFF_SIZE; cirCnt++)
    {
        Com_RxIPduRuntimeBuff[cirCnt] = COM_CFG_RXIPDU_INITVALUE(cirCnt);
    }

    /* Bool signal Runtime value, based on bool signal or group signal init value */
    for(cirCnt = 0; cirCnt < COM_CONST_SIGNALBOOLBUFF_SIZE; cirCnt++)
    {
        Com_SignalBoolRuntimeBuff[cirCnt] = COM_CFG_SIGNALBOOL_INITVALUE(cirCnt);
    }

    /* 8Bit signal Runtime value, based on uint8, sint8, uint8N signal or group signal init value */
    for(cirCnt = 0; cirCnt < COM_CONST_SIGNAL8BITBUFF_SIZE; cirCnt++)
    {
        Com_Signal8BitRuntimeBuff[cirCnt] = COM_CFG_SIGNAL8BIT_INITVALUE(cirCnt);
    }

    /* 16Bit signal Runtime value, based on uint16, sint16 signal or group signal init value */
    for(cirCnt = 0; cirCnt < COM_CONST_SIGNAL16BITBUFF_SIZE; cirCnt++)
    {
        Com_Signal16BitRuntimeBuff[cirCnt] = COM_CFG_SIGNAL16BIT_INITVALUE(cirCnt);
    }

    /* 32Bit signal Runtime value, based on uint32, sint32 signal or group signal init value */
    for(cirCnt = 0; cirCnt < COM_CONST_SIGNAL32BITBUFF_SIZE; cirCnt++)
    {
        Com_Signal32BitRuntimeBuff[cirCnt] = COM_CFG_SIGNAL32BIT_INITVALUE(cirCnt);
    }

    /* bool rx group signal Runtime value, and shadow buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXGRPSIGBOOLBUFF_SIZE; cirCnt++)
    {
        Com_RxGroupSignalBoolRtimeBuff[cirCnt] = COM_CFG_RXGRPSIGBOOL_INITVALUE(cirCnt);
        Com_RxShadowSignalBoolRTimeBuff[cirCnt] = Com_RxGroupSignalBoolRtimeBuff[cirCnt];
    }

    /* 8Bit rx group signal Runtime value, and shadow buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXGRPSIG8BITBUFF_SIZE; cirCnt++)
    {
        Com_RxGroupSignal8BitRtimeBuff[cirCnt] = COM_CFG_RXGRPSIG8BIT_INITVALUE(cirCnt);
        Com_RxShadowSignal8BitRTimeBuff[cirCnt] = Com_RxGroupSignal8BitRtimeBuff[cirCnt];
    }

    /* 16Bit rx group signal Runtime value, and shadow buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXGRPSIG16BITBUFF_SIZE; cirCnt++)
    {
        Com_RxGroupSignal16BitRtimeBuff[cirCnt] = COM_CFG_RXGRPSIG16BIT_INITVALUE(cirCnt);
        Com_RxShadowSignal16BitRTimeBuff[cirCnt] = Com_RxGroupSignal16BitRtimeBuff[cirCnt];
    }

    /* 32Bit rx group signal Runtime value, and shadow buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXGRPSIG32BITBUFF_SIZE; cirCnt++)
    {
        Com_RxGroupSignal32BitRtimeBuff[cirCnt] = COM_CFG_RXGRPSIG32BIT_INITVALUE(cirCnt);
        Com_RxShadowSignal32BitRTimeBuff[cirCnt] = Com_RxGroupSignal32BitRtimeBuff[cirCnt];
    }

    /* Clear Rx IPdu Deferred Buffer */
    for(cirCnt = 0; cirCnt < COM_RXSINGLEDEFIPDU_SIZE; cirCnt++)
    {
        Com_RxDefIPduBuff[cirCnt] = 0u;
    }

    #if (STD_ON == COM_FILTER_ENABLE)
    /* Bool rx group signal Runtime value, and old value buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXSIGNALNOBBOOLSIZE; cirCnt++)
    {
        Com_RxSignalNOBBoolRtimeOldBuff[cirCnt] = COM_CFG_RXSIGNOB8BIT_INITVALUE(cirCnt);
        Com_RxSignalNOBBoolRtimeBuff[cirCnt] = Com_RxSignalNOBBoolRtimeOldBuff[cirCnt];
    }

    /* 8Bit rx group signal Runtime value, and old value buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXSIGNALNOB8BITSIZE; cirCnt++)
    {
        Com_RxSignalNOB8BitRtimeOldBuff[cirCnt] = COM_CFG_RXSIGNOB8BIT_INITVALUE(cirCnt);
        Com_RxSignalNOB8BitRtimeBuff[cirCnt] = Com_RxSignalNOB8BitRtimeOldBuff[cirCnt];
    }

    /* 16Bit rx group signal Runtime value, and old value buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXSIGNALNOB16BITSIZE; cirCnt++)
    {
        Com_RxSignalNOB16BitRtimeOldBuff[cirCnt] = COM_CFG_RXSIGNOB16BIT_INITVALUE(cirCnt);
        Com_RxSignalNOB16BitRtimeBuff[cirCnt] = Com_RxSignalNOB16BitRtimeOldBuff[cirCnt];
    }

    /* 32Bit rx group signal Runtime value, and old value buffer, based on init value */
    for(cirCnt = 0; cirCnt < COM_CONST_RXSIGNALNOB32BITSIZE; cirCnt++)
    {
        Com_RxSignalNOB32BitRtimeOldBuff[cirCnt] = COM_CFG_RXSIGNOB32BIT_INITVALUE(cirCnt);
        Com_RxSignalNOB32BitRtimeBuff[cirCnt] = Com_RxSignalNOB32BitRtimeOldBuff[cirCnt];
    }
    #endif    /* STD_ON == COM_FILTER_ENABLE */

    /* Init RxIPduRuntime Flag & DM counter */
    for(cirCnt = 0; cirCnt < COM_CONST_RXIPDU_NUM; cirCnt++)
    {
        Com_RxIPduRTimeFlag[cirCnt] = 0u;
        Com_RxIPduRTimeDMCntr[cirCnt] = 0u;
    }

    /* Init RxIPduRuntime length, used by deferred process */
    if(COM_CONST_RXIPDUBUFF_SIZE > 0u)
    {
        for(cirCnt = 0; cirCnt < COM_CONST_RXIPDU_NUM; cirCnt++)
        {
            Com_RxIPduRunTimeLength[cirCnt] = 0u;
        }
    }

    /* Init Runtime TxMode Timer */
    for(cirCnt = 0; cirCnt < COM_CONST_TXIPDU_NUM; cirCnt++)
    {
        Com_TxIPduRTimeState[cirCnt].txDMCntr = 0;
        Com_TxIPduRTimeState[cirCnt].txMDTCntr = 0;
        Com_TxIPduRTimeState[cirCnt].txNTimesPDCntr = 0;
        Com_TxIPduRTimeState[cirCnt].txPDCntr = 0;
        Com_TxIPduRTimeState[cirCnt].txRmnTimesOfN = 0;
        Com_TxIPduRTimeState[cirCnt].txTMSCntr = COM_CFG_TXIPDU_TMSCNTRINIT(cirCnt);
        Com_TxIPduRTimeFlag[cirCnt] = 0;
    }

    /* Init TxSignalGroup Runtime flag */
    for(cirCnt = 0; cirCnt < COM_TXSIGNALGROUP_NUMBER; cirCnt++)
    {
        Com_TxSigGrpRTimeFlag[cirCnt] = 0u;
    }

    #if (STD_ON == COM_FILTER_ENABLE)
    /* Init Tx signal Runtime last TMC, default is TRUE */
    for(cirCnt = 0; cirCnt < COM_CONST_TXSIGNALTMCRST_NUM; cirCnt++)
    {
        Com_TxSignalRTimeLastTMC[cirCnt] = COM_CFG_TXSIGNAL_INITTMC(cirCnt);
    }

    /* Init Tx Signal Occurence counter */
    for(cirCnt = 0; cirCnt < COM_TXSIGNAL_ONEEVERYN_NUMBER; cirCnt++)
    {
        /* DL201401 */
        Com_TxSignalRTimeOccurenceCntr[cirCnt] = 0u;
        /* DL201401 */
    }

    /* Init Tx Group Signal Occurence counter */
    for(cirCnt = 0; cirCnt < COM_TXGRPSIG_ONEEVERYN_NUMBER; cirCnt++)
    {
        /* DL201401 */
        Com_TxGrpSigRTimeOccurenceCntr[cirCnt] = 0u;
        /* DL201401 */
    }

    /* Init Rx Signal Occurence counter */
    for(cirCnt = 0; cirCnt < COM_CONST_RXSIGNALONEEVERYN_NUM; cirCnt++)
    {
        /* DL201401 */
        Com_RxSignalRTimeOccurenceCntr[cirCnt] = 0;
        /* DL201401 */
    }

    /* Init Tx Signal Group Runtime TMC counter, default filter is TRUE */
    for(cirCnt = 0; cirCnt < COM_CONST_TXSIGNALGROUPTMC_NUM; cirCnt++)
    {
        /* DL201442 */
        Com_TxSignalGroupRTimeTMCCntr[cirCnt] = COM_CFG_TXSIGGRP_INITTMC(cirCnt);
        if(Com_TxSignalGroupRTimeTMCCntr[cirCnt] > 0u)
        {
            Com_TxSignalGroupRTimeLastTMC[cirCnt] = TRUE;
        }
        else
        {
            Com_TxSignalGroupRTimeLastTMC[cirCnt] = FALSE;
        }
        /* DL201442 */
    }

    /* Init Tx Signal Runtime TMC counter, default filter is TRUE */
    for(cirCnt = 0; cirCnt < COM_COMST_TXGROUPSIGNALTMCSRT_NUM; cirCnt++)
    {
        Com_TxGrpSigRTimeLastTMC[cirCnt] = COM_CFG_TXGRPSIG_INITTMC(cirCnt);
    }
    #endif    /* STD_ON == COM_FILTER_ENABLE */

    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    /* Init Rx Signal DM counter */
    for(cirCnt = 0; cirCnt < COM_CONST_SIGNAL_DM_CNTRNUM; cirCnt++)
    {
       Com_RxUpdateSignalRTimeDMCntr[cirCnt] = 0;
    }

    /* Init Rx Signal Group DM counter */
    for(cirCnt = 0; cirCnt < COM_CONST_SIGGRP_DM_CNTRNUM; cirCnt++)
    {
        Com_RxUpdateSigGrpRTimeDMCntr[cirCnt] = 0;
    }
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

    /* DL201429 */
    #if((STD_ON == COM_GATEWAY_ENABLE)&&(STD_ON == COM_FILTER_ENABLE))
    /* Init Destination Description TMC Init Value, TRUE */
    for(cirCnt = 0u; cirCnt < COM_CONST_DESTDESCRIPTMCSRT_NUM; cirCnt++)
    {
        Com_DestDescripRTimeLastTMC[cirCnt] = COM_CFG_GWDESTDESC_INITTMC(cirCnt);
    }

    for(cirCnt = 0u; cirCnt < COM_DESTDESCRIP_ONEEVERYN_NUMBER; cirCnt++)
    {
        Com_DestDescRTimeOccurenceCntr[cirCnt] = 0u;
    }
    /* DL201429 */

    #endif
    /* DL201429 */

    /* Init IPduGroup Active Flag */
    Com_IPduGroupActive[0]= 0u;
    Com_IPduGroupActive[1]= 0u;

    /* Set Com_Status Flag */
    Com_Status = COM_INIT;

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               This service stops the inter-ECU communication. All started
 *                     I-PDU groups are stopped and have to be started again, if
 *                     needed, after Com_Init is called. By a call to ComDeInit COM
 *                     is put into an not initialized state.
 * ServiceId           0x02
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant
 * Param-Name[in]      None
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_DeInit(void)
{
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_DEINIT, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    /* Check Com_Status is COM_INIT, and then implement DeInit */
    if(COM_INIT == Com_Status)
    {
        uint16 cirCntr = 0u;

        /* clear All IPduGroup Active Flag */
        Com_IPduGroupActive[0]= 0u;
        Com_IPduGroupActive[1]= 0u;

        /* Disable Rx IPdu & DM */
        for(cirCntr = 0u; cirCntr < COM_CONST_RXIPDU_NUM; cirCntr++)
        {
            Com_RxIPduRTimeFlag[cirCntr] = 0u;
            Com_RxIPduRTimeDMCntr[cirCntr] = 0u;
        }

        /* Disable Tx IPdu & DM */
        for(cirCntr = 0u; cirCntr < COM_CONST_TXIPDU_NUM; cirCntr++)
        {
            Com_TxIPduRTimeFlag[cirCntr] = 0u;
            Com_TxIPduRTimeState[cirCntr].txDMCntr = 0u;
            Com_TxIPduRTimeState[cirCntr].txMDTCntr = 0u;
            Com_TxIPduRTimeState[cirCntr].txNTimesPDCntr = 0u;
            Com_TxIPduRTimeState[cirCntr].txPDCntr = 0u;
            Com_TxIPduRTimeState[cirCntr].txRmnTimesOfN = 0u;
            Com_TxIPduRTimeState[cirCntr].txTMSCntr = 0u;
        }

        /* Disable update_signal DM */
        /* DL201418 */
        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        for(cirCntr = 0u; cirCntr < COM_CONST_SIGNAL_DM_CNTRNUM; cirCntr++)
        {
            Com_RxUpdateSignalRTimeDMCntr[cirCntr] = 0u;
        }
        /* DL201418 */
        #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

        /* Disable update_signalgroup DM */
        /* DL201418 */
        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        for(cirCntr = 0u; cirCntr < COM_CONST_SIGGRP_DM_CNTRNUM; cirCntr++)
        {
            Com_RxUpdateSigGrpRTimeDMCntr[cirCntr] = 0u;
        }
        /* DL201418 */
        #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

        /* set Com_Status */
        Com_Status = COM_UNINIT;
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Starts a preconfigured I-PDU group.
 * ServiceId           0x03
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different I-PDU groups.
 *                     Non reentrant for the same I-PDU group.
 * Param-Name[in]      IpduGroupId: Id of I-PDU group to be started.
 *                     Initialize: Flag to request initialization of the data in
 *                     the data in the I-PDUs of this I-PDU group.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_IpduGroupStart(Com_PduGroupIdType IpduGroupId, boolean Initialize)
{
    P2CONST(Com_IPduGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    ipduGrpPbPtr = NULL_PTR;
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_IPDUGROUPSTART, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(IpduGroupId >= COM_SUPPORT_IPDUGROUP_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_IPDUGROUPSTART, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    ipduGrpPbPtr = &(COM_PTR_IPDUGROUPPB(IpduGroupId));

    /* Parent IPdu Group */
    if(0u == Com_GetFlagState(ipduGrpPbPtr->comIPduGroupFlag,COM_IPDUGROUPDEGREE_MASK))
    {
        /* SW201401 */
        if(0u == ((Com_IPduGroupActive[IpduGroupId>>5u]) & (((uint32)1u) << (IpduGroupId & 0x1fuL))))
        /* Com_IPduGroupActive_H */
        {
            /* DL201432 */
            Com_PduGroupIdType cirCntr = 0u;

            Com_IPduGroupActive[IpduGroupId>>5u] |= (((uint32)1u) << (IpduGroupId & 0x1fuL));
            if(0u == Com_GetFlagState(ipduGrpPbPtr->comIPduGroupFlag,COM_IPDUGROUPDIRECT_MASK))
            {
                /* DL201425, DL201432 */
                /* Loop all sub IPdu Group of this parent IPdu Group */
                for(cirCntr = (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStart);
                    cirCntr <= (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStop); cirCntr++)
                {
                    Com_RxSubIPduGroupStart(cirCntr, Initialize);
                }
            }
            else
            {
                /* DL201425, DL201432 */
                /* Loop all sub IPdu Group of this parent IPdu Group */
                for(cirCntr = (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStart);
                    cirCntr <= (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStop); cirCntr++)
                {
                    Com_TxSubIPduGroupStart(cirCntr, Initialize);
                }
            }
        }
        /* SW201401 */
    }
    else    /* This IPduGroup is Sub IPduGroup */
    {
        /* IPdu Group Direction */
        if(0u == Com_GetFlagState(ipduGrpPbPtr->comIPduGroupFlag,COM_IPDUGROUPDIRECT_MASK))
        {
            Com_RxSubIPduGroupStart(IpduGroupId, Initialize);
        }
        else    /* Tx IPduGroup */
        {
            Com_TxSubIPduGroupStart(IpduGroupId, Initialize);
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Stops a preconfigured I-PDU group.
 * ServiceId           0x04
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different I-PDU groups.
 *                     Non reentrant for the same I-PDU group.
 * Param-Name[in]      IpduGroupId: Id of I-PDU group to be stopped.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_IpduGroupStop(Com_PduGroupIdType IpduGroupId)
{
    P2CONST(Com_IPduGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    ipduGrpPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_IPDUGROUPSTOP, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(IpduGroupId >= COM_SUPPORT_IPDUGROUP_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_IPDUGROUPSTOP, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    ipduGrpPbPtr = &(COM_PTR_IPDUGROUPPB(IpduGroupId));

    /* Parent IPdu Group */
    if(0u == Com_GetFlagState(ipduGrpPbPtr->comIPduGroupFlag,COM_IPDUGROUPDEGREE_MASK))
    {
        /* SW201402 */
        if(0u != ((Com_IPduGroupActive[IpduGroupId>>5u]) & (((uint32)1u) << (IpduGroupId & 0x1fuL))))    
        {
            /* DL201432 */
            Com_PduGroupIdType cirCntr = 0u;

            Com_IPduGroupActive[IpduGroupId>>5u] &= ~(((uint32)1u) << (IpduGroupId & 0x1fuL));
            if(0u == Com_GetFlagState(ipduGrpPbPtr->comIPduGroupFlag,COM_IPDUGROUPDIRECT_MASK))
            {
                /* DL201425, DL201432 */
                /* Loop all sub IPdu Group of this parent IPdu Group */
                for(cirCntr = (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStart);
                    cirCntr <= (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStop); cirCntr++)
                {
                    Com_RxSubIPduGroupStop(cirCntr);
                }
            }
            else    /* Tx IPduGroup */
            {
                /* DL201425, DL201432 */
                /* Loop all sub IPdu Group of this parent IPdu Group */
                for(cirCntr = (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStart);
                    cirCntr <= (Com_PduGroupIdType)(ipduGrpPbPtr->comIPduOrGroupStop); cirCntr++)
                {
                    Com_TxSubIPduGroupStop(cirCntr);
                }
            }
        }
        /* SW201402 */
    }
    else
    {
        /* IPdu Group Direction */
        if(0u == Com_GetFlagState(ipduGrpPbPtr->comIPduGroupFlag,COM_IPDUGROUPDIRECT_MASK))
        {
            Com_RxSubIPduGroupStop(IpduGroupId);
        }
        else     /* Tx IPduGroup */
        {
            Com_TxSubIPduGroupStop(IpduGroupId);
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Enables the reception deadline monitoring for the I-PDUs
 *                     within the given I-PDU group.
 * ServiceId           0x06
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different I-PDU groups.
 *                     Non reentrant for the same I-PDU group.
 * Param-Name[in]      IpduGroupId: Id of I-PDU group where reception DM shall be
 *                     enabled.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_EnableReceptionDM(Com_PduGroupIdType IpduGroupId)
{
    P2CONST(Com_IPduGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    ipduGroupPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_ENABLERECEPTIONDM, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(IpduGroupId >= COM_SUPPORT_IPDUGROUP_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_ENABLERECEPTIONDM, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    ipduGroupPbPtr = &(COM_PTR_IPDUGROUPPB(IpduGroupId));

    /* SW201403 */
    /* IPduGroup Active, Rx */
    if( (0u != ((Com_IPduGroupActive[IpduGroupId>>5u]) & (((uint32)1u) << (IpduGroupId&0x1fu))))
      &&(0u == Com_GetFlagState(ipduGroupPbPtr->comIPduGroupFlag,COM_IPDUGROUPDIRECT_MASK)))
    {
        /* Parent IPduGroup */
        if(0u == Com_GetFlagState(ipduGroupPbPtr->comIPduGroupFlag,COM_IPDUGROUPDEGREE_MASK))
        {
            /* DL201432 */
            Com_PduGroupIdType subIPduGroupIndex;

            /* DL201425, DL201432 */
            /* Loop Rx IPdu Group of this Parent IPduGroup */
            for( subIPduGroupIndex = (Com_PduGroupIdType)(ipduGroupPbPtr->comIPduOrGroupStart);
                 subIPduGroupIndex <= (Com_PduGroupIdType)(ipduGroupPbPtr->comIPduOrGroupStop);
                 subIPduGroupIndex++ )
            {
                Com_EnableRxSubIPduGroupDM(subIPduGroupIndex);
            }
        }
        else    /* Sub IPduGroup */
        {
            Com_EnableRxSubIPduGroupDM(IpduGroupId);
        }
    }
    /* SW201403 */

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Disables the reception deadline monitoring for the I-PDUs
 *                     within the given I-PDU group.
 * ServiceId           0x05
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different I-PDU groups.
 *                     Non reentrant for the same I-PDU group.
 * Param-Name[in]      IpduGroupId: Id of I-PDU group where reception DM shall be
 *                     disabled.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_DisableReceptionDM(Com_PduGroupIdType IpduGroupId)
{
    P2CONST(Com_IPduGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    ipduGroupPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_DISALERECEPTIONDM, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(IpduGroupId >= COM_SUPPORT_IPDUGROUP_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_DISALERECEPTIONDM, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    ipduGroupPbPtr = &(COM_PTR_IPDUGROUPPB(IpduGroupId));

    /* SW201404 */
    /* IPduGroup Active, Rx */
    if( (0u != ((Com_IPduGroupActive[IpduGroupId>>5u]) & (((uint32)1u) << (IpduGroupId&0x1fu))))
       &&(0u == Com_GetFlagState(ipduGroupPbPtr->comIPduGroupFlag,COM_IPDUGROUPDIRECT_MASK)) )
    {
        /* Parent IPduGroup */
        if(0u == Com_GetFlagState(ipduGroupPbPtr->comIPduGroupFlag,COM_IPDUGROUPDEGREE_MASK))
        {
            /* DL201432 */
            Com_PduGroupIdType subIPduGroupIndex;

            /* DL201425, DL201432 */
            /* Loop Rx IPdu Group of this Parent IPduGroup */
            for( subIPduGroupIndex = (Com_PduGroupIdType)(ipduGroupPbPtr->comIPduOrGroupStart);
                 subIPduGroupIndex <= (Com_PduGroupIdType)(ipduGroupPbPtr->comIPduOrGroupStop);
                 subIPduGroupIndex++ )
            {
                Com_DisableRxSubIPduGroupDM(subIPduGroupIndex);
            }
        }
        else    /* Sub IPduGroup */
        {
            Com_DisableRxSubIPduGroupDM(IpduGroupId);
        }
    }
    /* SW201404 */

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Returns the status of the AUTOSAR COM module.
 * ServiceId           0x07
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant
 * Param-Name[in]      None
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              Com_StatusType: COM_UNINIT: AUTOSAR COM is not initialized
 *                                                 and not usable.
 *                                     COM_INIT: AUTOSAR COM is initialized and
 *                                               usable.
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(Com_StatusType , COM_CODE)
Com_GetStatus(void)
{
    /* SW201435 */
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_GETSTATUS, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        Com_Status = COM_UNINIT;
    }
    #endif

    return Com_Status;
    /* SW201435 */
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Provides the unique identifier of the configuration.
 * ServiceId           0x08
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant
 * Param-Name[in]      None
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint32: configured ConfigurationID.
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint32 , COM_CODE)
Com_GetConfigurationId(void)
{
    /* SW201434 */
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_GETCONFIRGURATIONID, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        /* SW201444 */
        return 0xffffffffU;
        /* SW201444 */
    }
    #endif
    /* SW201434 */

    return COM_CONST_CONFIG_ID;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               The service Com_SendSignal updates the signal object identified
 *                     by SignalId with the signal referenced by the SignalDataPtr
 *                     parameter.
 * ServiceId           0x0a
 * Sync/Async          Asynchronous
 * Reentrancy          Non Reentrant for the same signal. Reentrant for different signals.
 * Param-Name[in]      SignalId: Id of Signal to be sent.
 *                     SignalDataPtr: Reference to the signal data to be transmitted.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint8: E_OK: service has been accepted.
 *                            COM_SERVICE_NOT_AVAILABLE: corresponding I-PDU group was
 *                                                       stopped (or service failed
 *                                                       due to development error).
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8, COM_CODE)
Com_SendSignal
(
    Com_SignalIdType SignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr
)
{

    IpduHandlePrmType ipduPrm;
    uint8 rtnV = E_OK;
    /* SW201462 */
    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    signalPBPtr = NULL_PTR;
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPBPtr = NULL_PTR;
    P2CONST(Com_TxModeType, AUTOMATIC, COM_CONST_PBCFG)
    txModePtr = NULL_PTR;
    /* SW201462 */
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRTStatePtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_SENDSIGNAL, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    
    if(SignalId >= COM_TXSIGNALNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_SENDSIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }

    if(NULL_PTR == SignalDataPtr)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_SENDSIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }
    
    if(FALSE == detNoErr)
    {
        return COM_SERVICE_NOT_AVAILABLE;
    }
    #endif

    signalPBPtr = &(COM_PTR_TXSIGNALPB(SignalId));
    txIpduPBPtr = &(COM_PTR_TXIPDUPB(signalPBPtr->comIPduRefIndex));
    txModePtr = &(COM_PTR_TXMODE(txIpduPBPtr->comTxModeTrueIndex));
    txIpduRTStatePtr = &(Com_TxIPduRTimeState[signalPBPtr->comIPduRefIndex]);

    /* SW201414 */
    /* if the filter macro was switch off, the TM parameter will be set with true value. */
    ipduPrm.ipduTxMode = txModePtr->comTxMode;
    ipduPrm.NTimeCntr = txModePtr->comTxModeRepeatPeriod;
    ipduPrm.PeriodCntr = txModePtr->comTxModeTimePeriod;
    ipduPrm.rptNum = txModePtr->comTxModeNumOfRepeat;
    /* SW201414 */
    ipduPrm.signalChanged = FALSE;
    ipduPrm.tmChanged = FALSE;    

    #if (STD_ON == COM_FILTER_ENABLE)
    /* if the signal has been configured filter, do TMS calulation. */
    if(COM_INDEX_DEFAULT != (signalPBPtr->comFilterFuncIndex))
    {
        /* return whether tm changed, after TMS. */
        ipduPrm.tmChanged = Com_TxSignalTMSHandle(SignalId, SignalDataPtr);
    }
                                                            
    if(0u == (txIpduRTStatePtr->txTMSCntr))                   
    {/* TMS==FALSE */   
         txModePtr = &(COM_PTR_TXMODE(txIpduPBPtr->comTxModeFalseIndex));
         ipduPrm.ipduTxMode = txModePtr->comTxMode;
         ipduPrm.NTimeCntr = txModePtr->comTxModeRepeatPeriod;
         ipduPrm.PeriodCntr = txModePtr->comTxModeTimePeriod;
         ipduPrm.rptNum = txModePtr->comTxModeNumOfRepeat;             
    }     
   
    /* SW201414 */
    #endif    /* STD_ON == COM_FILTER_ENABLE */ 


    /* implement B-End and L-End exchange and packing the result into Ipdu Buffer. */
    if(COM_TXSINGAL_TYPE_UNIT8_N == (Com_GetFlagState(signalPBPtr->comSignalPBFlag,COM_PBTXSIGNALTYPE_MASK)))
    {
        /* when signal type is UINT8N, use Com_U8NSignalPack to execute. */
        ipduPrm.signalChanged = Com_U8NSignalPack(SignalId, SignalDataPtr); 
    }
    else
    {
        /* DL201435 */
        /* update tx signal buffer and check if the sending signal value changed. */
        Com_TxSetSignalBuff(signalPBPtr, SignalDataPtr, ipduPrm.signalChanged)
        /* DL201435 */

        /* DL201424 */
        if(TRUE == ipduPrm.signalChanged)
        {
            /* execute the signal BL-End exchanged, then pack the result into ipdu Tx buffer. */
            Com_TxPack(signalPBPtr->comSignalPBFlag, signalPBPtr->comSignalLSBPos, signalPBPtr->comSignalMSBPos,
                SignalDataPtr, &Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]);
        }
    }

    /* DL201418 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    /* according to configuration, handle update bit function. */
    if(COM_INDEX_DEFAULT != (signalPBPtr->comSignalUpdateBitPos))                                    
    {                                                                                                      
        if( ((ipduPrm.ipduTxMode) == COM_TX_MODE_NONE) || ((ipduPrm.ipduTxMode) == COM_TX_MODE_PERIODIC)                        
          ||( (((ipduPrm.ipduTxMode) == COM_TX_MODE_DIRECT)||((ipduPrm.ipduTxMode) != COM_TX_MODE_MIXED))                         
            &&((ipduPrm.rptNum) <= 1u)))                                                                        
        {                                                                                                   
            Com_SetBitTo8ByteArr(                                                                          
            (&(Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]))    
           ,(signalPBPtr->comSignalUpdateBitPos)                                                     
           );                                                                                              
        }                                                                                                   
    }
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

    /* if the ipdu group is active, the ipdu including the sending signal will be dealed with*/
    if(Com_GetFlagState(( Com_TxIPduRTimeFlag[signalPBPtr->comIPduRefIndex]), COM_RT_TXIPDUFLAG_ACTIVE_MASK) > 0u)
    {
        /* If the TM changed, the DM counter will be cleared first. 
           Then the DM, MDT, N-Times N, N-Times Timer counter, PT will
           be set under practical situations. */
        if(TRUE == ipduPrm.tmChanged)
        {
            txIpduRTStatePtr->txDMCntr = 0u;
        }
        
        if(ipduPrm.ipduTxMode != COM_TX_MODE_NONE)
        { 
            /* if TM != NONE, invoke the Com_IpduHandleInSendSignal function. */
            /* SW201458 */
            Com_IpduHandleInSendSignal( SignalId, 
                                                                    /* SW201415 */
                                                                    #if (STD_ON == COM_GATEWAY_ENABLE)
                                                                    FALSE,
                                                                    FALSE,
                                                                    #endif
                                                                    /* SW201415 */
                                                                    &ipduPrm);
        } 
        else
        {
            /* if TM == NONE, clear all Timer counters except for MDT. */
            txIpduRTStatePtr->txRmnTimesOfN = 0u;
            txIpduRTStatePtr->txNTimesPDCntr = 0u;
            txIpduRTStatePtr->txPDCntr = 0u;
            txIpduRTStatePtr->txDMCntr = 0u;
        }
    }
    else
    { 
        /* if the ipdu group is inactive, return service not available. 
           in the same time, invoke the err callback function. */
        if(NULL_PTR != Com_TxSignalLT[SignalId].comCbkTxErrFunc)
        {
            Com_TxSignalLT[SignalId].comCbkTxErrFunc();
        }
        rtnV = COM_SERVICE_NOT_AVAILABLE;
    }

    return rtnV;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               The service Com_ReceiveSignal updates the signal referenced
 *                     by SignalDataPtr with the data in the signal object identified
 *                     by SignalId.
 * ServiceId           0x0b
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal. Reentrant for different signals.
 * Param-Name[in]      SignalId: Id of Signal to be received.
 * Param-Name[out]     SignalDataPtr: Reference to the signal data in which to store
 *                                    the received data.
 * Param-Name[in/out]  None
 * Return              uint8: E_OK: service has been accepted.
 *                            COM_SERVICE_NOT_AVAILABLE: corresponding I-PDU group was
 *                                                       stopped (or service failed
 *                                                       due to development error).
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8 , COM_CODE)
Com_ReceiveSignal
(
    Com_SignalIdType SignalId, 
    P2VAR(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr
)
{
    uint8 ret = COM_SERVICE_NOT_AVAILABLE;
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESIGNAL, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(SignalId >= COM_RXSIGNALNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(NULL_PTR == SignalDataPtr)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return COM_SERVICE_NOT_AVAILABLE;
    }
    #endif

    rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(SignalId));

    /* Check IPdu which this Signal belonged is Actived or not */
    if(Com_GetFlagState(Com_RxIPduRTimeFlag[rxSignalPbPtr->comIPduRefIndex],COM_RT_RXIPDUFLAG_ACTIVE_MASK) > 0u)
    {
        /* Get signal type, decide signal value is in which Runtime buffer */
        switch(Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGNALTYPE_MASK))
        {
            case COM_RXSIGNAL_TYPE_BOOLEAN:
                *((boolean*)SignalDataPtr) = Com_SignalBoolRuntimeBuff[rxSignalPbPtr->comSignalBufIndex];
                break;
            case COM_RXSIGNAL_TYPE_SINT8:
            case COM_RXSIGNAL_TYPE_UINT8:
                *((uint8*)SignalDataPtr) = Com_Signal8BitRuntimeBuff[rxSignalPbPtr->comSignalBufIndex];
                break;
            case COM_RXSINGAL_TYPE_UNIT8_N:
            {
                uint16 valueLoop = 0u;
                /* DL201434 */
                uint8 signalSize = 0u;

                if(rxSignalPbPtr->comSignalLSBPos < rxSignalPbPtr->comSignalMSBPos)
                {
                    signalSize = (uint8)((rxSignalPbPtr->comSignalMSBPos - rxSignalPbPtr->comSignalLSBPos) + 1u);
                }
                else
                {
                    signalSize = (uint8)((rxSignalPbPtr->comSignalLSBPos - rxSignalPbPtr->comSignalMSBPos) + 1u);
                }
                /* DL201434 */

                /* Copy Uint8N signal value one byte by one */
                for(valueLoop = 0u; valueLoop < signalSize; valueLoop++)
                {
                    ((uint8*)SignalDataPtr)[valueLoop] = Com_Signal8BitRuntimeBuff[(COM_PTR_RXSIGNALPB(SignalId).comSignalBufIndex + valueLoop)];
                }
                break;
            }
            case COM_RXSIGNAL_TYPE_SINT16:
            case COM_RXSIGNAL_TYPE_UINT16:
                *((uint16*)SignalDataPtr) = Com_Signal16BitRuntimeBuff[COM_PTR_RXSIGNALPB(SignalId).comSignalBufIndex];
                break;
            case COM_RXSIGNAL_TYPE_SINT32:
            case COM_RXSIGNAL_TYPE_UINT32:
                *((uint32*)SignalDataPtr) = Com_Signal32BitRuntimeBuff[COM_PTR_RXSIGNALPB(SignalId).comSignalBufIndex];
                break;
            default:
                break;
        }

        ret = E_OK;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/* SW201406 */
/******************************************************************************/
/*
 * Brief               The service Com_UpdateShadowSignal updates a group signal
 *                     with the data, referenced by SignalDataPtr.
 * ServiceId           0x0c
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal. Reentrant for
 *                     different group signals.
 * Param-Name[in]      SignalId: Id of group signal to be updated.
 *                     SignalDataPtr: Reference to the group signal data to be updated.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_UpdateShadowSignal
(
    Com_SignalIdType SignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr
)
{
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_UPDATESHADOWSIGNAL, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    
    if(SignalId >= COM_TXGROUPSIGNALNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_UPDATESHADOWSIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }

    if(NULL_PTR == SignalDataPtr)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_UPDATESHADOWSIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }
    
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif
    Com_UpdateShadowSignalInternal( SignalId, 
                                                         #if (STD_ON == COM_GATEWAY_ENABLE)  
                                                         FALSE, FALSE, 
                                                         #endif
                                                         SignalDataPtr);
   
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201406 */

/* SW201407 */
/******************************************************************************/
/*
 * Brief               The service Com_UpdateShadowSignalInternal updates a group signal
 *                     with the data, referenced by SignalDataPtr.
 * ServiceId           0x0c
 * Sync/Async     Synchronous
 * Reentrancy        Non Reentrant for the same group signal. Reentrant for different group signals.
 * Param-Name[in]      SignalId: Id of group signal to be updated.
 *                            isGateway: if this function was called by Com_MainFunctionRouteSignals.
 *                            isBigEnd: if the group signal is uint8N, then if the endiness is big.
 *                            SignalDataPtr: Reference to the group signal data to be updated.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_UpdateShadowSignal
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void , COM_CODE)
Com_UpdateShadowSignalInternal
(
    Com_SignalIdType SignalId, 
    #if (STD_ON == COM_GATEWAY_ENABLE)   
    boolean isBigEnd,
    /* SW201448 */
    boolean isGetValFromIpduBuf,
    /* SW201448 */
    #endif
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr
)
{
    boolean sigChanged = FALSE;
    P2CONST(Com_TxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txGrpSigPBPtr = &(COM_PTR_TXGRPSIGPB(SignalId));

    /* DL201419 */
    #if (STD_ON == COM_FILTER_ENABLE)
    /* if the group signal has been configured filter, execute the TMS. */
    if(COM_INDEX_DEFAULT != (txGrpSigPBPtr->comFilterFuncIndex))
    {
        /* Calculate the TMC of signal group. 
           Algorithm is that the signal group TMC is regarded as group signal
           TMS object, the TMS result will be stored in signal group TMC. */
        Com_TxSignalGroupTMCHandle(SignalId, SignalDataPtr);
    }
    /* DL201419 */
    #endif    /* STD_ON == COM_FILTER_ENABLE */
    
    {
        uint16 txsigBuffInd =  txGrpSigPBPtr->comGroupSignalBufIndex;
        uint8 * sig8BitRTBuffptr = &(Com_Signal8BitRuntimeBuff[txsigBuffInd]);
        
        switch(Com_GetFlagState((txGrpSigPBPtr->comGroupSignalPBFlag),COM_PBTXSIGNALTYPE_MASK))
        {
            case COM_RXSIGNAL_TYPE_BOOLEAN:
                /* if group signal type is bool, and the value is different with signal
                   buffer, update signal buffer, and return signal changed. */
                if(Com_SignalBoolRuntimeBuff[txsigBuffInd] != *((boolean*)(SignalDataPtr)))
                {
                    Com_SignalBoolRuntimeBuff[txsigBuffInd] = *((boolean*)(SignalDataPtr));
                    sigChanged = TRUE;
                }
                break;

            case COM_RXSIGNAL_TYPE_SINT8:
            case COM_RXSIGNAL_TYPE_UINT8:
                /* if group signal type is 8bit, and the value is different with signal
                   buffer, update signal buffer, and return signal changed. */
                if((*sig8BitRTBuffptr) != *((uint8*)(SignalDataPtr)))
                {
                    (*sig8BitRTBuffptr) = *((uint8*)(SignalDataPtr));
                    sigChanged = TRUE;
                }
                break;

            case COM_RXSIGNAL_TYPE_SINT16:
            case COM_RXSIGNAL_TYPE_UINT16:
                /* if group signal type is 16bit, and the value is different with signal
                   buffer, update signal buffer, and return signal changed. */
                if(Com_Signal16BitRuntimeBuff[txsigBuffInd] != *((uint16*)(SignalDataPtr)))
                {
                    Com_Signal16BitRuntimeBuff[txsigBuffInd] = *((uint16*)(SignalDataPtr));
                    sigChanged = TRUE;
                }
                break;

            case COM_RXSIGNAL_TYPE_UINT32:
            case COM_RXSIGNAL_TYPE_SINT32:
                /* if group signal type is 16bit, and the value is different with signal
                   buffer, update signal buffer, and return signal changed. */
                if(Com_Signal32BitRuntimeBuff[txsigBuffInd] != *((uint32*)(SignalDataPtr)))
                {
                    Com_Signal32BitRuntimeBuff[txsigBuffInd] = *((uint32*)(SignalDataPtr));
                    sigChanged = TRUE;
                }
                break;

            case COM_RXSINGAL_TYPE_UNIT8_N:
            {
                uint8 cnt = 0;
                uint16 signalSize = 0u;
                /* if group signal type is 8bit N, and the value is different with signal
                   buffer, update signal buffer, and return signal changed. */
                /* DL201434 */

                if(txGrpSigPBPtr->comGroupSignalLSBPos < txGrpSigPBPtr->comGroupSignalMSBPos)
                {
                    signalSize = txGrpSigPBPtr->comGroupSignalMSBPos - txGrpSigPBPtr->comGroupSignalLSBPos;
                }
                else
                {
                    signalSize = txGrpSigPBPtr->comGroupSignalLSBPos - txGrpSigPBPtr->comGroupSignalMSBPos;
                }

                /* SW201409 */
                #if (STD_ON == COM_GATEWAY_ENABLE) 
                /* SW201409 */
				
                /* SW201448 */
                if(TRUE == isGetValFromIpduBuf)
                /* SW201448 */
                {
                     for(cnt = 0; cnt <= signalSize; cnt++)
                     {
                        if(TRUE == isBigEnd)
                        { 
                            if( (sig8BitRTBuffptr[cnt]) != (((uint8*)SignalDataPtr)[signalSize - cnt]) )
                            {
                                sig8BitRTBuffptr[cnt] =  ((uint8*)SignalDataPtr)[signalSize - cnt];
					sigChanged = TRUE;
                            }
                        }
                        else
                        {
                            if( (sig8BitRTBuffptr[cnt]) != (((uint8*)SignalDataPtr)[cnt]) )
                            {
                                sig8BitRTBuffptr[cnt] =  ((uint8*)SignalDataPtr)[cnt];
                                sigChanged = TRUE;
                            }
                        }
                	 }
                }
                else
                /* SW201409 */
		   #endif
                /* SW201409 */
                {
                    /* SW201449 */
                    for(cnt = 0; cnt <= signalSize; cnt++)
                    /* SW201449 */
                    {
                        if( (((uint8*)SignalDataPtr)[cnt])
                          !=(sig8BitRTBuffptr[cnt]) )
                        {                           
                            sig8BitRTBuffptr[cnt] = ((uint8*)SignalDataPtr)[cnt];
                            sigChanged = TRUE;
                        }
                    }
                }
		   /* DL201434 */
            }
                break;

            default:
                break;
        }
    }
    
    /*   TOC == TriggerOnChange, T == Trigger, P == Pending,                *
     *   WTP == has Transfer property,  WOTP == has not Transfer property,  *
     *   O == need transmit, X == no need transmint, C == changed,          *
     *   NC = not changed.                                                  *
     *   Below truth table only valid for Direct and Mix TM.                *
     *    _______________________________________________                   *
     *   |____T___|______________TOC____________|___P___|                   *
     *   |        |________WTP______|___WOTP____|       |                   *
     *   |        |___TOC___|___P___|__C__|_NC__|       |                   *
     *   |    O   |_C_|_NC__|       |     |     |   X   |                   *
     *   |        |   |     |       |     |     |       |                   *
     *   |        | O |  X  |   X   |  O  |  X  |       |                   *
     *   |________|___|_____|_______|____ |_____|_______|                   *
     *                                                                      *
     *   According to above truth table, when the value is 'O', the I-pdu   *
     *   will be sent, and its N-Times N and N-Times Timer Counter will be  *
     *   assign initialization value.                                       */ 
    {
        Com_SignalGroupIdType sigGrpRef = Com_TxGroupSignalLT[SignalId].comSignalGroupRef;
        uint8 grpSigProp = Com_GetFlagState((txGrpSigPBPtr->comGroupSignalPBFlag),COM_PBTXPROP_MASK);
        uint8 sigGrpProp = Com_GetFlagState((COM_PTR_TXSIGGRPPB(sigGrpRef).comSignalGroupPBFlag), COM_PBTXPROP_MASK);
        uint8 sigWithPropFlag = Com_GetFlagState((COM_PTR_TXSIGGRPPB(sigGrpRef).comSignalGroupPBFlag), COM_PBTXGRPSIGWITHPROP_MASK);

        if( (sigGrpProp == COM_TX_PROP_TRIGGERED)
          ||( (sigGrpProp == COM_TX_PROP_TRIGGERED_ON_CHANGE) && (sigWithPropFlag>0) 
            &&(grpSigProp == COM_TX_PROP_TRIGGERED_ON_CHANGE) &&(TRUE == sigChanged))
          ||( (sigGrpProp == COM_TX_PROP_TRIGGERED_ON_CHANGE) && (sigWithPropFlag==0) 
            &&(TRUE == sigChanged)) )
        {
            /* the flag 'COM_RT_TXSIGGRP_NEEDNTIMESTX' will be set, then in Com_SendSignalGroup
               will arbitrate the transmit and all timer counters initializations respectively.*/
            Com_SetFlagState(Com_TxSigGrpRTimeFlag[sigGrpRef], COM_RT_TXSIGGRP_NEEDNTIMESTX);
        }
    }
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* SW201407 */

/******************************************************************************/
/*
 * Brief               The service Com_SendSignalGroup copies the content of the
 *                     associated shadow buffer to the associated I-PDU.
 * ServiceId           0x0d
 * Sync/Async          Asynchronous
 * Reentrancy          Non Reentrant for the same group signal. Reentrant for
 *                     different group signals.
 * Param-Name[in]      SignalGroupId: Id of signal group to be send.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint8: E_OK: service has been accepted.
 *                            COM_SERVICE_NOT_AVAILABLE: corresponding I-PDU group was
 *                                                       stopped (or service failed
 *                                                       due to development error).
 * PreCondition        None
 * CallByAPI           By RTE
 */
/*******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8 , COM_CODE)
Com_SendSignalGroup(Com_SignalGroupIdType SignalGroupId)
{
    uint8 rtnV = E_OK;
    PduIdType ipduId = 0xffff;
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIdpuRTStatePtr = NULL_PTR;
    IpduHandlePrmType ipduPrm;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_SENDSIGNALGROUP, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    
    if(SignalGroupId >= COM_TXSIGNALGROUPNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_SENDSIGNALGROUP, COM_E_PARAM);
        detNoErr = FALSE;
    }
    
    if(FALSE == detNoErr)
    {
        return COM_SERVICE_NOT_AVAILABLE;
    }
    #endif

    ipduId = COM_CFG_TXSIGNALGROUP_IPDUIDREF(SignalGroupId);
    txIdpuRTStatePtr = &(Com_TxIPduRTimeState[ipduId]);
	
    {
        P2CONST(Com_TxModeType, AUTOMATIC, COM_CONST_PBCFG)
        txModePtr = &(COM_PTR_TXMODE(COM_PTR_TXIPDUPB(ipduId).comTxModeTrueIndex));
        /* SW201414 */
        /* if the filter macro was switch off, the TM parameter will be set with true value. */
        ipduPrm.ipduTxMode = txModePtr->comTxMode;
        ipduPrm.NTimeCntr = txModePtr->comTxModeRepeatPeriod;
        ipduPrm.PeriodCntr = txModePtr->comTxModeTimePeriod;
        ipduPrm.rptNum = txModePtr->comTxModeNumOfRepeat;
        /* SW201414 */
        ipduPrm.signalChanged = FALSE;
        ipduPrm.tmChanged = FALSE;
        
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* if the signal group has been configured filter, do TMS calculation. */
        if(COM_INDEX_DEFAULT != (Com_TxSignalGroupLT[SignalGroupId].comTMCIndex))
        {
            /* return whether tm changed, after TMS calculation. */
            ipduPrm.tmChanged = Com_TxSignalGroupTMSHandle(SignalGroupId);
        }
        /* DL201419 */
        /* SW201414 */
        if(0u == (txIdpuRTStatePtr->txTMSCntr))                   
        {/* TMS==FALSE */    
             txModePtr = &(COM_PTR_TXMODE(COM_PTR_TXIPDUPB(ipduId).comTxModeFalseIndex));
             ipduPrm.ipduTxMode = txModePtr->comTxMode;                  
             ipduPrm.rptNum = txModePtr->comTxModeNumOfRepeat;                    
             ipduPrm.PeriodCntr = txModePtr->comTxModeTimePeriod;
             ipduPrm.NTimeCntr = txModePtr->comTxModeRepeatPeriod;
        } 
        /* SW201414 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
    }

    /* implement B-End and L-End exchange and packing the result into Ipdu Buffer. */
    Com_TxPackSignalGroup(SignalGroupId);

    /* DL201418 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    /* according to configuration, handle update bit function. */
    Com_HandleSigGrpUpdateBit(SignalGroupId, ipduPrm.ipduTxMode, ipduPrm.rptNum)
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

    /* if the ipdu group is active, the ipdu including the sending signal group will be dealed with. */
    if(Com_GetFlagState(( Com_TxIPduRTimeFlag[ipduId])
           , COM_RT_TXIPDUFLAG_ACTIVE_MASK) > 0u)
    {
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* If the TM changed, the DM counter will be cleared first. 
           Then the DM, MDT, N-Times N, N-Times Timer counter, PT will
           be set under practical situations. */
        if(TRUE == ipduPrm.tmChanged)
        {
            txIdpuRTStatePtr->txDMCntr = 0u;
        }
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        
        if(ipduPrm.ipduTxMode != COM_TX_MODE_NONE)
        {
            /* if TM != NONE, invoke the Com_IpduHandleInSendSignalGrp function. */
            Com_IpduHandleInSendSignalGrp( SignalGroupId, 
                                                                /* SW201415 */
                                                                #if (STD_ON == COM_GATEWAY_ENABLE)
                                                                FALSE,
                                                                #endif
                                                                /* SW201415 */
                                                                &ipduPrm);
        } 
        else
        {   
            /* if TM == NONE, clear all Timer counters except for MDT. */
            txIdpuRTStatePtr->txRmnTimesOfN = 0u;
            txIdpuRTStatePtr->txNTimesPDCntr = 0u;
            txIdpuRTStatePtr->txPDCntr = 0u;
            txIdpuRTStatePtr->txDMCntr = 0u;
        }
    }
    else
    {
        /* if the ipdu group is inactive, return service not available. 
           in the same time, invoke the err callback function. */
        if(NULL_PTR != Com_TxSignalGroupLT[SignalGroupId].comSignalGroupCbkTxErrFnc)
        {
            Com_TxSignalGroupLT[SignalGroupId].comSignalGroupCbkTxErrFnc();
        }
        rtnV = COM_SERVICE_NOT_AVAILABLE;
    }
        
    return rtnV;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               The service Com_ReceiveSignalGroup copies the received
 *                     signal group from the I-PDU to the shadow buffer.
 * ServiceId           0x0e
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal. Reentrant for
 *                     different group signals.
 * Param-Name[in]      SignalGroupId: Id of signal group to be received.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint8: E_OK: service has been accepted.
 *                            COM_SERVICE_NOT_AVAILABLE: corresponding I-PDU group was
 *                                                       stopped (or service failed
 *                                                       due to development error).
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8 , COM_CODE)
Com_ReceiveSignalGroup(Com_SignalGroupIdType SignalGroupId)
{
    uint8 ret = COM_SERVICE_NOT_AVAILABLE;
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESIGNALGROUP, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(SignalGroupId >= COM_RXSIGNALGROUPNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESIGNALGROUP, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return COM_SERVICE_NOT_AVAILABLE;
    }
    #endif

    /* Check IPdu which this Signal belonged is Actived or not */
    if(Com_GetFlagState(Com_RxIPduRTimeFlag[COM_PTR_RXSIGGRPPB(SignalGroupId).comIPduRefIndex],COM_RT_RXIPDUFLAG_ACTIVE_MASK) > 0u)
    {
        uint16 cirCntr = 0u;

        /* copy GroupSignal Value from Groupsignal Buffer to Shadow Buffer */
        SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
        /* loop all group signal of this group */
        /* DL201425 */
        for(cirCntr = Com_RxSignalGroupLT[SignalGroupId].comRxGroupSignalIndexStart;
            cirCntr <= Com_RxSignalGroupLT[SignalGroupId].comRxGroupSignalIndexStop; cirCntr++)
        {
            rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(cirCntr));
            /* Get Group Signal type, decide signal value is in which Runtime buffer */
            switch(Com_GetFlagState((rxGrpSignalPbPtr->comGroupSignalPBFlag),COM_PBRXSIGNALTYPE_MASK))
            {
                case COM_RXSIGNAL_TYPE_BOOLEAN:
                    Com_RxShadowSignalBoolRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]
                      = Com_RxGroupSignalBoolRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
                    break;

                case COM_RXSIGNAL_TYPE_SINT8:
                case COM_RXSIGNAL_TYPE_UINT8:
                    Com_RxShadowSignal8BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]
                      = Com_RxGroupSignal8BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
                    break;

                case COM_RXSINGAL_TYPE_UNIT8_N:
                    {
                        uint8 groupSignalSizeCntr = 0u;
                        /* DL201434 */
                        uint8 signalSize = 0u;

                        if(rxGrpSignalPbPtr->comGroupSignalLSBPos < rxGrpSignalPbPtr->comGroupSignalMSBPos)
                        {
                            signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalMSBPos - rxGrpSignalPbPtr->comGroupSignalLSBPos) + 1u);
                        }
                        else
                        {
                            signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalLSBPos - rxGrpSignalPbPtr->comGroupSignalMSBPos) + 1u);
                        }

                        /* Copy Uint8N signal value one byte by one */
                        for(; groupSignalSizeCntr < signalSize; groupSignalSizeCntr++)
                        /* DL201434 */
                        {
                            Com_RxShadowSignal8BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex + groupSignalSizeCntr]
                              = Com_RxGroupSignal8BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex + groupSignalSizeCntr];
                        }
                    }
                    break;

                case COM_RXSIGNAL_TYPE_SINT16:
                case COM_RXSIGNAL_TYPE_UINT16:
                    Com_RxShadowSignal16BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]
                      = Com_RxGroupSignal16BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
                    break;

                case COM_RXSIGNAL_TYPE_SINT32:
                case COM_RXSIGNAL_TYPE_UINT32:
                    Com_RxShadowSignal32BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]
                      = Com_RxGroupSignal32BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
                    break;

                default:
                    break;
            }
        }
        /* DL201425 */
        SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);

        ret = E_OK;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               The service Com_ReceiveShadowSignal updates the group signal
 *                     which is referenced by SignalDataPtr with the data in the
 *                     shadow buffer.
 * ServiceId           0x0f
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal. Reentrant for
 *                     different group signals.
 * Param-Name[in]      SignalId: Id of group signal to be received.
 * Param-Name[out]     SignalDataPtr: Reference to the group signal data in which
 *                                    to store the received data.
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_ReceiveShadowSignal
(
    Com_SignalIdType SignalId, 
    P2VAR(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr
)
{
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = NULL_PTR;
		
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESHADOWSIGNAL, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(SignalId >= COM_RXGROUPSIGNALNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESHADOWSIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }

    /* SW201436 */
    if(NULL_PTR == SignalDataPtr)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RECEIVESHADOWSIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }
    /* SW201436 */

    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(SignalId));

    /* Recive Shadow Signal is no matter this IPdu is Active or not */
    switch(Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBRXSIGNALTYPE_MASK))
    {
        /* different signal type value is in different buffer */
        case COM_RXSIGNAL_TYPE_BOOLEAN:
            *((boolean*)SignalDataPtr) = Com_RxShadowSignalBoolRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
            break;

        case COM_RXSIGNAL_TYPE_SINT8:
        case COM_RXSIGNAL_TYPE_UINT8:
            *((uint8*)SignalDataPtr) = Com_RxShadowSignal8BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
            break;

        case COM_RXSINGAL_TYPE_UNIT8_N:
        {
            uint8 valueLoop = 0u;
            /* DL201434 */
            uint8 signalSize = 0u;

            if(rxGrpSignalPbPtr->comGroupSignalLSBPos < rxGrpSignalPbPtr->comGroupSignalMSBPos)
            {
                signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalMSBPos - rxGrpSignalPbPtr->comGroupSignalLSBPos) + 1u);
            }
            else
            {
                signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalLSBPos - rxGrpSignalPbPtr->comGroupSignalMSBPos) + 1u);
            }

            /* copy data one byte by one */
            for(valueLoop = 0u; valueLoop < signalSize; valueLoop++)
            /* DL201434 */
            {
                ((uint8*)SignalDataPtr)[valueLoop] = Com_RxShadowSignal8BitRTimeBuff[(rxGrpSignalPbPtr->comGroupSignalBufIndex + valueLoop)];
            }
            break;
        }

        case COM_RXSIGNAL_TYPE_SINT16:
        case COM_RXSIGNAL_TYPE_UINT16:
            *((uint16*)SignalDataPtr) = Com_RxShadowSignal16BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
            break;

        case COM_RXSIGNAL_TYPE_SINT32:
        case COM_RXSIGNAL_TYPE_UINT32:
            *((uint32*)SignalDataPtr) = Com_RxShadowSignal32BitRTimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex];
            break;

        default:
            break;
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Sender side AUTOSAR Software Component indicates via the RTE
 *                     to AUTOSAR COM that it is not able to provide a valid value
 *                     for the corresponding signal.
 * ServiceId           0x10
 * Sync/Async          Asynchronous
 * Reentrancy          Non Reentrant for the same signal. Reentrant for different signals.
 * Param-Name[in]      SignalId: Id of signal to be invalidated.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint8: E_OK: service has been accepted.
 *                            COM_SERVICE_NOT_AVAILABLE: corresponding I-PDU group was
 *                                                       stopped (or service failed
 *                                                       due to development error).
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8 , COM_CODE)
Com_InvalidateSignal(Com_SignalIdType SignalId)
{
    uint8 ret = COM_SERVICE_NOT_AVAILABLE;
    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSignalPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INVALIDATESIGNAL, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if((SignalId >= COM_TXSIGNALNUM) ||(COM_INDEX_DEFAULT == COM_PTR_TXSIGNALPB(SignalId).comSignalnvValueIndex))
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INVALIDATESIGNAL, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
       return ret;
    }
    #endif

    txSignalPbPtr = &(COM_PTR_TXSIGNALPB(SignalId));

    switch(Com_GetFlagState(COM_CFG_TXSIGNAL_PBFLAG(SignalId),COM_PBTXSIGNALTYPE_MASK))
    {
        /* send signal use cfged invalidate value */
        case COM_TXSIGNAL_TYPE_BOOLEAN:
            ret = Com_SendSignal(SignalId, &(COM_CFG_SIGNALBOOL_INVALIDVALUE(txSignalPbPtr->comSignalnvValueIndex)));
            break;

        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSINGAL_TYPE_UNIT8_N:
            ret = Com_SendSignal(SignalId, &(COM_CFG_SIGNAL8BIT_INVALIDVALUE(txSignalPbPtr->comSignalnvValueIndex)));
            break;

        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_UINT16:
            ret = Com_SendSignal(SignalId, &(COM_CFG_SIGNAL16BIT_INVALIDVALUE(txSignalPbPtr->comSignalnvValueIndex)));
            break;

        case COM_TXSIGNAL_TYPE_SINT32:
        case COM_TXSIGNAL_TYPE_UINT32:
            ret = Com_SendSignal(SignalId, &(COM_CFG_SIGNAL32BIT_INVALIDVALUE(txSignalPbPtr->comSignalnvValueIndex)));
            break;

        default:
            break;

    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Sender side AUTOSAR Software Component indicates via the
 *                     RTE to AUTOSAR COM that it is not able to provide a valid
 *                     value for the corresponding group signal.
 * ServiceId           0x16
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal. Reentrant for different signals.
 * Param-Name[in]      SignalId: Id of signal to be sent.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_InvalidateShadowSignal(Com_SignalIdType SignalId)
{
     P2CONST(Com_TxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
     txGrpSignalPbPtr = NULL_PTR;

     #if(STD_ON == COM_DEV_ERROR_DETECT)
     boolean detNoErr = TRUE;
     if(COM_INIT != Com_Status)
     {
         Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INVALIDATESHADOWSIGNAL, COM_E_UNINIT);
         detNoErr = FALSE;
     }
     if((SignalId >= COM_TXGROUPSIGNALNUM) ||(COM_INDEX_DEFAULT == COM_PTR_TXGRPSIGPB(SignalId).comGroupSignalInvValueIndex))
     {
         Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INVALIDATESHADOWSIGNAL, COM_E_PARAM);
         detNoErr = FALSE;
     }
     if(FALSE == detNoErr)
     {
         return ;
     }
     #endif

     txGrpSignalPbPtr = &(COM_PTR_TXGRPSIGPB(SignalId));
     
     switch(Com_GetFlagState(txGrpSignalPbPtr->comGroupSignalPBFlag,COM_PBTXSIGNALTYPE_MASK))
     {
         /* update shadow signal use cfged invalidate value */
         case COM_TXSIGNAL_TYPE_BOOLEAN:
            /* SW201408 */
            Com_UpdateShadowSignalInternal(SignalId, 
            /* SW201409 */
            #if (STD_ON == COM_GATEWAY_ENABLE)
            FALSE, FALSE, 
            #endif
            /* SW201409 */
            &(COM_CFG_SIGNALBOOL_INVALIDVALUE(txGrpSignalPbPtr->comGroupSignalInvValueIndex)) );
            break;

         case COM_TXSIGNAL_TYPE_SINT8:
         case COM_TXSIGNAL_TYPE_UINT8:
         case COM_TXSINGAL_TYPE_UNIT8_N:
            /* SW201408 */
            Com_UpdateShadowSignalInternal(SignalId, 
            /* SW201409 */
            #if (STD_ON == COM_GATEWAY_ENABLE)
            FALSE, FALSE, 
            #endif
            /* SW201409 */
            &(COM_CFG_SIGNAL8BIT_INVALIDVALUE(txGrpSignalPbPtr->comGroupSignalInvValueIndex)) );
            break;

         case COM_TXSIGNAL_TYPE_SINT16:
         case COM_TXSIGNAL_TYPE_UINT16:
            /* SW201408 */
            Com_UpdateShadowSignalInternal(SignalId, 
            /* SW201409 */
            #if (STD_ON == COM_GATEWAY_ENABLE)
            FALSE, FALSE, 
            #endif
            /* SW201409 */ 
            &(COM_CFG_SIGNAL16BIT_INVALIDVALUE(txGrpSignalPbPtr->comGroupSignalInvValueIndex)) );
            break;
             

         case COM_TXSIGNAL_TYPE_SINT32:
         case COM_TXSIGNAL_TYPE_UINT32:
            /* SW201408 */
            Com_UpdateShadowSignalInternal(SignalId, 
            /* SW201409 */
            #if (STD_ON == COM_GATEWAY_ENABLE)
            FALSE, FALSE, 
            #endif
            /* SW201409 */
            &(COM_CFG_SIGNAL32BIT_INVALIDVALUE(txGrpSignalPbPtr->comGroupSignalInvValueIndex)) );
            break;

         default:
             break;
     }

     return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Sender side AUTOSAR Software Component indicates via the RTE
 *                     to AUTOSAR COM that it is not able to provide a valid value
 *                     for the corresponding signal group.
 * ServiceId           0x1b
 * Sync/Async          Asynchronous
 * Reentrancy          Non Reentrant for the same signal group. Reentrant for different
 *                     signal groups.
 * Param-Name[in]      SignalGroupId: Id of signal group to be invalidated.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint8: E_OK: service has been accepted.
 *                            COM_SERVICE_NOT_AVAILABLE: corresponding I-PDU group was
 *                                                       stopped (or service failed
 *                                                       due to development error).
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8 , COM_CODE)
Com_InvalidateSignalGroup(Com_SignalGroupIdType SignalGroupId)
{
    uint8 ret = COM_SERVICE_NOT_AVAILABLE;
    uint16 cirCntr = 0u;
    P2CONST(Com_TxSignalGroupLTType, AUTOMATIC, COM_CONST)
    txSignalGrpLtPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INVALIDATESIGNALGROUP, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(SignalGroupId >= COM_TXSIGNALGROUPNUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_INVALIDATESIGNALGROUP, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ret;
    }
    #endif

    txSignalGrpLtPtr = &(Com_TxSignalGroupLT[SignalGroupId]);

    /* SW201405 */
    SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
    /* first update shadow buffer of this signal group */
    /* DL201425 */
    for(cirCntr = txSignalGrpLtPtr->comTxGroupSignalIndexStart;
        cirCntr <= txSignalGrpLtPtr->comTxGroupSignalIndexStop; cirCntr++)
    {
        if(COM_INDEX_DEFAULT != COM_CFG_TXGRPSIG_INVLDVALUE_INDEX(cirCntr))
        {
            Com_InvalidateShadowSignal(cirCntr);
        }
    }
    /* DL201425 */

    /* send this signal group use cfged invalidate value */
    ret = Com_SendSignalGroup(SignalGroupId);
    SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
    /* SW201405 */

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               By a call to Com_TriggerIPDUSend the I-PDU with the given
 *                     ID is triggered for transmission.
 * ServiceId           0x17
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant
 * Param-Name[in]      ComTxPduId: The I-PDU-ID if the I-PDU that shall be triggered
 *                                 for sending.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void , COM_CODE)
Com_TriggerIPDUSend(PduIdType ComTxPduId)
{
    /* SW201442 */
    #define LOWLPDUID COM_CFG_LOWLAYER_PDUID(ComTxPduId) 

    /* SW201432 */
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TRIGGERIPDUSEND, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(ComTxPduId >= COM_CONST_TXIPDU_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TRIGGERIPDUSEND, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return;
    }
    #endif
    /* SW201432 */

    if(0 == Com_TxIPduRTimeState[ComTxPduId].txMDTCntr)
    {
        PduInfoType PduInfo;
        PduInfo.SduLength = COM_CFG_TXIPDU_SIZE(ComTxPduId);
        PduInfo.SduDataPtr = &(Com_TxIPduRuntimeBuff[COM_CFG_TXIPDU_BUFFINDEX(ComTxPduId)]);

	  /* SW201446 */
        if( (COM_INDEX_DEFAULT != Com_TxIPduCalloutLT[ComTxPduId]) &&
            (TRUE == IPdu_CalloutFnc[Com_TxIPduCalloutLT[ComTxPduId]](ComTxPduId, PduInfo.SduDataPtr)) )
        {
            (void)PduR_ComTransmit(LOWLPDUID, &PduInfo);
        }
        /* SW201446 */

        Com_TxIPduRTimeState[ComTxPduId].txMDTCntr = COM_CFG_TXIPDU_MDT(ComTxPduId);     
    }
    /* SW201447 */
    else
    {
        Com_SetFlagState(Com_TxIPduRTimeFlag[ComTxPduId], COM_RT_TXIPDUFLAG_DELAY_MASK);
    }
    /* SW201447 */
    return ;

    #undef LOWLPDUID
    /* SW201442 */
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               This function is called by the lower layer when an AUTOSAR
 *                     COM I-PDU shall be transmitted.
 * ServiceId           0x13
 * Sync/Async          Synchronous
 * Reentrancy          Non reentrant for the same PDU-ID. Reentrant for different PDU-ID.
 * Param-Name[in]      ComTxPduId: ID of AUTOSAR COM I-PDU that is requested to be
 *                                 transmitted by AUTOSAR COM.
 * Param-Name[out]     None
 * Param-Name[in/out]  PduInfoPtr: Contains a pointer to a buffer (SduDataPtr) to where
 *                                 the SDU shall be copied to. On return, the service
 *                                 will indicate the length of the copied SDU data in
 *                                 SduLength.
 * Return              Std_ReturnType:E_OK: SDU has been copied and SduLength indicates
                                            the number of copied bytes.
 *                                    E_NOT_OK: No SDU has been copied. SduLength has
 *                                              not been set.
 * PreCondition        None
 * CallByAPI           By Lower Layer
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(Std_ReturnType , COM_CODE)
Com_TriggerTransmit
(
    PduIdType ComTxPduId, 
    CONSTP2VAR(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr
)
{
    /* SW201443 */
    /* SW201433 */
    PduLengthType pduLength = 0;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TRIGGERTRANSMIT, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    
    if(ComTxPduId >= COM_CONST_TXIPDU_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TRIGGERTRANSMIT, COM_E_PARAM);
        detNoErr = FALSE;
    }

    if(NULL_PTR == PduInfoPtr)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TRIGGERTRANSMIT, COM_E_PARAM);
        detNoErr = FALSE;
    }
    
    if(FALSE == detNoErr)
    {
        return E_NOT_OK ;
    }
    #endif
    /* SW201433 */

    SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
    for(pduLength = 0; pduLength < COM_CFG_TXIPDU_SIZE(ComTxPduId); pduLength++)
    {
        PduInfoPtr->SduDataPtr[pduLength] = Com_TxIPduRuntimeBuff[COM_CFG_TXIPDU_BUFFINDEX(ComTxPduId)+pduLength];
    }
	
    PduInfoPtr->SduLength = COM_CFG_TXIPDU_SIZE(ComTxPduId);
    SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);

    return E_OK; 
    /* SW201442 */
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               This function is called by the lower layer after an 
 *                     I-PDU has been received.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant
 * Param-Name[in]      ComRxPduId:ID of received IPDU.
 * Param-Name[out]     PduInfoPtr:Contains the length (SduLength) of the 
 *                     received I-PDU and a pointer to a buffer (SduDataPtr) 
 *                     containing the I-PDU.
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_RxIndication
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_RxIndication
(
    PduIdType ComRxPduId, 
    P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr
)
{
    uint16 cirCnt = 0u;
    P2CONST(Com_RxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxIpduPbPtr = &(COM_PTR_RXIPDUPB(ComRxPduId));
    Com_RxIPduFlagRTType * rxIpduRtFlag = &(Com_RxIPduRTimeFlag[ComRxPduId]);
     
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RXINDICATION, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    
    if(ComRxPduId >= COM_CONST_RXIPDU_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RXINDICATION, COM_E_PARAM);
        detNoErr = FALSE;
    }

    if(NULL_PTR == PduInfoPtr)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_RXINDICATION, COM_E_PARAM);
        detNoErr = FALSE;
    }
    
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif
    /* if Dm is switch on and rx ipdu length is greater than zero. */
    if(((Com_GetFlagState(*rxIpduRtFlag, COM_RT_RXIPDUFLAG_ACTIVE_MASK)) > 0u)
 	   &&(Com_GetFlagState(*rxIpduRtFlag, COM_RT_RXIPDUFLAG_ENABLEDM_MASK) != 0u)
       && ((PduInfoPtr->SduLength) > 0u))
    {
        /* Update the signal DM counter. */
        Com_RxIPduRTimeDMCntr[ComRxPduId] = rxIpduPbPtr->comIPduDM;
    }
   
    if((COM_INDEX_DEFAULT != Com_RxIPduCalloutLT[ComRxPduId])
        && (TRUE != IPdu_CalloutFnc[(Com_RxIPduCalloutLT[ComRxPduId])](ComRxPduId, (PduInfoPtr->SduDataPtr))))
    {
    	return;
    }
    /* if the ipdu was configured to be Deffer or gateway, the rx data should be 
       be copy to Com_RxIPduRuntimeBuff. */
    if(Com_GetFlagState(rxIpduPbPtr->comIPduFlag, COM_RXIPDU_NEEDCOPY_MASK) > 0u)
    {
        SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
        /* poll the rx ipdu buffer by every byte. */
        for(cirCnt = 0u; cirCnt<PduInfoPtr->SduLength; cirCnt++)
        {
            /* copy the rx ptr data into ipdu run time buffer byte by byte. */
            Com_RxIPduRuntimeBuff[rxIpduPbPtr->comRxIPduBufIndex + cirCnt] =
            (PduInfoPtr->SduDataPtr)[cirCnt];
        }

        /* copy the rx ptr valid data lenth into ipdu run time length buffer. */
        Com_RxIPduRunTimeLength[ComRxPduId] = PduInfoPtr->SduLength;
        SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
        /* SW201441 */	
        #if (STD_ON == COM_GATEWAY_ENABLE)
        if( (  COM_RXIPDU_GW_MASK 
            ==(Com_GetFlagState(rxIpduPbPtr->comIPduFlag,COM_RXIPDU_GW_MASK))  )
         /* SW201457 */
         &&(  COM_RXIPDU_SINGALPROCESS_MASK 
            !=(Com_GetFlagState(rxIpduPbPtr->comIPduFlag,COM_RXIPDU_SINGALPROCESS_MASK))  )
         /* SW201457 */
        )
        {
            Com_SetFlagState(*rxIpduRtFlag, COM_RT_RXIPDUFLAG_NEEDGW_MASK);
        }
	  #endif
        /* SW201441 */
    }
 
    
    if( ( COM_RXIPDU_SINGALPROCESS_MASK 
       ==(Com_GetFlagState(rxIpduPbPtr->comIPduFlag,COM_RXIPDU_SINGALPROCESS_MASK))) &&
       ((Com_GetFlagState(*rxIpduRtFlag, COM_RT_RXIPDUFLAG_ACTIVE_MASK)) > 0u))
    {
        /* if the ipdu was configured to be Deffer, 'COM_RT_RXIPDUFLAG_DEFERR_MASK' flag
           should be set, and then in Com_MainFunctionTx will handle the ipdu analysis 
           according to this flag. */
        /* if Rx Ipdu indication callback function has been configured, and it return TRUE.
           Or Rx Ipdu indication callback function has not been configured. */
        Com_SetFlagState(*rxIpduRtFlag, COM_RT_RXIPDUFLAG_DEFERR_MASK);
    }
    else if( ((Com_GetFlagState(*rxIpduRtFlag, COM_RT_RXIPDUFLAG_ACTIVE_MASK)) > 0u)
      &&(0u == (Com_GetFlagState(rxIpduPbPtr->comIPduFlag,COM_RXIPDU_SINGALPROCESS_MASK))) )
    {
        /* if the ipdu was configured to be Immediate and Ipdu group is active, the Rx Ipdu will 
           be analyzed immediately. */

        /* Execute the signal Rx Indication. */
        Com_SignalRxIndication(ComRxPduId, PduInfoPtr);

        /* Poll all the signal groups in this Ipdu. */
        for(cirCnt = rxIpduPbPtr->comSignalGroupIndexStart;
            cirCnt <= rxIpduPbPtr->comSignalGroupIndexStop;
            cirCnt++)
        {
            /* Execute the signal Rx Indication. */
            Com_SignalGroupRxIndication(COM_CFG_RXSIGNALGROUP_ID(cirCnt), PduInfoPtr);
        }
        
    }
    else {}

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               This function is called by the lower layer after the PDU
 *                     has been transmitted on the network.
 * ServiceId           0x15
 * Sync/Async          Synchronous
 * Reentrancy          Non reentrant for the same PDU-ID. Reentrant for different PDU-ID.
 * Param-Name[in]      ComTxPduId: ID of AUTOSAR COM I-PDU that has been transmitted.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Lower Layer
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_TxConfirmation(PduIdType ComTxPduId)
{
    P2VAR(Com_TxIPduFlagRTType, AUTOMATIC, COM_VAR)
    txIpduRtFlagPtr = &Com_TxIPduRTimeFlag[ComTxPduId];
    /* DL201411 */
    /* boolean needConfirm = FALSE; */
    /* DL201411 */
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TXCONFIRMATION, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(ComTxPduId >= COM_CONST_TXIPDU_NUM)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_TXCONFIRMATION, COM_E_PARAM);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    /* DL201411 */
    /* IPdu Active & Need Confirmation */
    if((COM_RT_TXIPDUFLAG_ACTIVE_MASK == Com_GetFlagState(*txIpduRtFlagPtr, COM_RT_TXIPDUFLAG_ACTIVE_MASK))
        && (0u != Com_GetFlagState(*txIpduRtFlagPtr, COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK)))
    /* DL201411 */
    {
        if(0u != Com_GetFlagState(COM_CFG_TXIPDU_FLAG(ComTxPduId), COM_TXIPDU_SINGALPROCESS_MASK))
        {
            /* set deferred flag, finish */
            Com_SetFlagState(*txIpduRtFlagPtr, COM_RT_TXIPDUFLAG_DEFERR_MASK);
        }
        else
        {
            Com_ConfirmationProcess(ComTxPduId);
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               This function shall perform the processing of the AUTOSAR
 *                     COM receive processing that are not directly initiated by
 *                     the calls from the RTE and PDU-R.
 * ServiceId           0x18
 * Sync/Async          None
 * Reentrancy          None
 * Param-Name[in]      None
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Fixed_Cyclic Task
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_MainFunctionRx(void)
{
    #define SIGNALID COM_CFG_SIGNALID_FROMDMINDEX(signaDMIndex)
    #define SIGNALGROUPID COM_CFG_SIGGRPID_FROMDMINDEX(grpSignalDMIndex)
    #define SIGNALLTFLAG (Com_RxSignalLT[SIGNALID].comSignalLTFlag)
    #define SIGNAGRPLLTFLAG (Com_RxSignalGroupLT[SIGNALGROUPID].comSignalGroupLTFlag)
      
    
    /* DL201427 */
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_MAINFUNCTIONRX, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif


    /* if updatebit function was disabled, the DM counter handling will be neglected.*/
    #if(STD_ON == COM_UPDATEBIT_ENABLE)
    {
        {
            uint16 signaDMIndex = 0u;
            P2VAR(Com_RxUpdateSignalDMRTType, AUTOMATIC, COM_VAR)
            rxUdtSignalRTDMCntPtr = NULL_PTR;
            P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
            rxSignalLtPtr = NULL_PTR;
             /* poll all signal DM counters. */
            for(signaDMIndex = 0u; signaDMIndex < COM_SIGNALDM_CNTRBUFF_SIZE; signaDMIndex++)
            {
                rxUdtSignalRTDMCntPtr = &(Com_RxUpdateSignalRTimeDMCntr[signaDMIndex]);
                rxSignalLtPtr = &(Com_RxSignalLT[SIGNALID]);
     		   /* check if this signal DM counter is greater than zero.*/
                if((*rxUdtSignalRTDMCntPtr) > 0u)
                {
                     /* signal DM counter minus one. */
                    (*rxUdtSignalRTDMCntPtr)--;
     
                    /* if DM counter was subtract to zero. */
                    if(0u == (*rxUdtSignalRTDMCntPtr))
                    {
                        /* if the signal corresponding to the DM index was configured with replace,
                        when DM counter move to zero(Rx time out), replace the signal buffer with
                        the initialization value. */
                        if(COM_RXDMTOUT_REPLACE == Com_GetFlagState(SIGNALLTFLAG, COM_RXDMTOUT_MASK))
                        {
                         /* replace the signal buffer with the initialization value. */
                         Com_ReplaceSignalValue(SIGNALID);
                        }
                        
                        /* update DM counter with configured value. */
                        *rxUdtSignalRTDMCntPtr = rxSignalLtPtr->comSignalDMTOut;
                         
                         /* if DM timeout Notification was configured. */
                        if(NULL_PTR != rxSignalLtPtr->comCbkRxTOutFunc)
                        {
                            /* invoke the DM timeout Notification. */
                            rxSignalLtPtr->comCbkRxTOutFunc();
                        }
                    }
                }
            }
        }

        {
            uint16 grpSignalDMIndex = 0u;
            P2VAR(Com_RxUpdateSignalGroupDMRTType, AUTOMATIC, COM_VAR)
            rxUdtSignalGrpRTDMCntPtr = NULL_PTR;
            P2CONST(Com_RxSignalGroupLTType, AUTOMATIC, COM_CONST)
            rxSignalGrpLtPtr = NULL_PTR;
            /* poll all signal group DM counters. */
            for(grpSignalDMIndex = 0u; grpSignalDMIndex < COM_SIGNALGROUPDM_CNTRBUFF_SIZE; grpSignalDMIndex++)
            {
                rxUdtSignalGrpRTDMCntPtr = &(Com_RxUpdateSigGrpRTimeDMCntr[grpSignalDMIndex]);
                rxSignalGrpLtPtr = &(Com_RxSignalGroupLT[SIGNALGROUPID]);
                /* check if this signal group DM counter is greater than zero.*/
                if((*rxUdtSignalGrpRTDMCntPtr) > 0u)
                {
                    /* signal group DM counter minus one. */
                    (*rxUdtSignalGrpRTDMCntPtr)--;
    
                    /* if DM counter was subtract to zero. */
                    if(0u == (*rxUdtSignalGrpRTDMCntPtr))
                    {
                        /* if the signal group  corresponding to the DM index was configured with replace,
                          when DM counter move to zero(Rx time out), replace the group signal buffer with
                          the initialization value. */
                        if(COM_RXDMTOUT_REPLACE == Com_GetFlagState(SIGNAGRPLLTFLAG, COM_RXDMTOUT_MASK))
                        {
                            /* replace the group signal buffer with the initialization value. */
                            Com_ReplaceGrpSignalsValue(SIGNALGROUPID);
                        }
                        
                        /* update DM counter with configured value. */
                        (*rxUdtSignalGrpRTDMCntPtr) = rxSignalGrpLtPtr->comSignalGroupDMCntr;
                        
                        /* if DM timeout Notification was configured. */
                        if(NULL_PTR != rxSignalGrpLtPtr->comSignalGroupCbkRxTOutFnc)
                        {
                            /* invoke the DM timeout Notification. */
                            rxSignalGrpLtPtr->comSignalGroupCbkRxTOutFnc();
                        }  
                    }                
                }            
            }
        }
    } 
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

    {
        uint16 ipduID = 0u;
        uint16 signalID = 0u;
        P2VAR(Com_RxIPduFlagRTType, AUTOMATIC, COM_VAR)
        rxIpduRtFlagPtr = NULL_PTR;
        P2CONST(Com_RxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
        rxIpduPbPtr = NULL_PTR;

        /* poll all Ipdu to implement ipdu DM relevant handling. */
        for(ipduID = 0u; ipduID < COM_CONST_RXIPDU_NUM; ipduID++)
        {
            rxIpduRtFlagPtr = &(Com_RxIPduRTimeFlag[ipduID]);
            rxIpduPbPtr = (Com_RxIPduPBType *)(&(COM_PTR_RXIPDUPB(ipduID)));
            /* if this IPdu is ACTIVE & Enable DM*/
            if(  (Com_GetFlagState(*rxIpduRtFlagPtr,COM_RT_RXIPDUFLAG_ACTIVE_MASK) > 0u) 
               &&(Com_GetFlagState(*rxIpduRtFlagPtr,COM_RT_RXIPDUFLAG_ENABLEDM_MASK) > 0u) )
            {
                Com_RxIPduRTDMRTType * rxIpduRTDMCntPtr = &(Com_RxIPduRTimeDMCntr[ipduID]);
                /* check if this ipdu DM counter is greater than zero.*/
                if(*rxIpduRTDMCntPtr > 0u)
                {
                     /* ipdu DM counter minus one. */
                     (*rxIpduRTDMCntPtr)--;
    
                     /* if DM counter was subtract to zero. */
                     if(0u == (*rxIpduRTDMCntPtr))
                     {
                         /* update DM counter with configured value. */
                         *rxIpduRTDMCntPtr = rxIpduPbPtr->comIPduDM;
    
                         /* poll all the signals. */
                         /* DL201425, DL201426 */
                         for( signalID = rxIpduPbPtr->comSignalIndexStart; signalID <= rxIpduPbPtr->comSignalIndexStop; signalID++ )
                         {          
                             /* only signals without update bit will be handled. */
                             /* DL201418 */
                             #if (STD_ON == COM_UPDATEBIT_ENABLE)
                             if(COM_INDEX_DEFAULT ==
                                 COM_PTR_RXSIGNALPB(COM_CFG_RXSIGNAL_ID(signalID)).comSignalUpdateBitPos)
                             /* DL201418 */
                             #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
                             {
                                 /* check if this signal configured timeout callback function. */
                                 if(NULL_PTR != Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalID)].comCbkRxTOutFunc)
                                 {
                                     /* invoke signal timeout callback function. */
                                     Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalID)].comCbkRxTOutFunc();
                                 }
    
                                 /* check if this signal value will be replaced under time out. */
                                 if( COM_RXDMTOUT_REPLACE
                                   ==Com_GetFlagState(Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalID)].comSignalLTFlag,
                                                      COM_RXDMTOUT_MASK))
                                 {
                                     /* replace the signal value with initialization value. */
                                     Com_ReplaceSignalValue(COM_CFG_RXSIGNAL_ID(signalID));
                                 }
                             }
                         }
                         {
                             uint16 signalGroupID = 0u;
                             /* DL201425, DL201426 */
                             /* poll all the signal groups. */
                             /* DL201425, DL201426 */
                             for( signalGroupID = rxIpduPbPtr->comSignalGroupIndexStart; signalGroupID <= rxIpduPbPtr->comSignalGroupIndexStop; signalGroupID++ )
                             {
                                 /* only signal groups without update bit will be handled. */
                                 /* DL201418 */
                                 #if (STD_ON == COM_UPDATEBIT_ENABLE)
                                 if(COM_INDEX_DEFAULT == COM_PTR_RXSIGGRPPB(COM_CFG_RXSIGNALGROUP_ID(signalGroupID)).comUpdateBitPos)
                                 /* DL201418 */
                                 #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
                                 {
                                     /* check if this signal group configured timeout callback function. */
                                     if(NULL_PTR !=
                                         Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalGroupID)].comSignalGroupCbkRxTOutFnc)
                                     {
                                         /* invoke signal group timeout callback function. */
                                         Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalGroupID)].comSignalGroupCbkRxTOutFnc();
                                     }
                                     
                                     /* check if this group signals value will be replaced under time out. */
                                     if( COM_RXDMTOUT_REPLACE
                                       ==Com_GetFlagState(Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalGroupID)].comSignalGroupLTFlag,
                                                          COM_RXDMTOUT_MASK) )
                                     {
                                         /* replace all the group signals value with initialization value. */
                                         Com_ReplaceGrpSignalsValue(COM_CFG_RXSIGNALGROUP_ID(signalGroupID));
                                     }
                                 }
                             }
                         }
                         /* DL201425, DL201426 */
                     }
                 }
            }
    
            /* 1)if the ipdu was configured to be deffered analysis.
                2)ipdu length is greater than zero. */
            if(  (0u != Com_GetFlagState(*rxIpduRtFlagPtr,COM_RT_RXIPDUFLAG_DEFERR_MASK))
              &&(Com_RxIPduRunTimeLength[ipduID] > 0u))
            {
                uint8 sduLoop = 0u;
                PduInfoType rxIPduInfo;
    
                /* SW201441 */
                #if (STD_ON == COM_GATEWAY_ENABLE)
                if( COM_RXIPDU_GW_MASK 
                ==(Com_GetFlagState(rxIpduPbPtr->comIPduFlag,COM_RXIPDU_GW_MASK)))
                {
                    Com_SetFlagState(*rxIpduRtFlagPtr, COM_RT_RXIPDUFLAG_NEEDGW_MASK);
                }
                #endif
                /* SW201441 */
                
                SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
                /* copy the ipdu run time buffer, which was write in Com_RxIndication, into 
                   specific ipdu buffer. */
                for(sduLoop = 0u; sduLoop < rxIpduPbPtr->comIPduSize; sduLoop++)
                {
                    Com_RxDefIPduBuff[sduLoop] = 
                    Com_RxIPduRuntimeBuff[rxIpduPbPtr->comRxIPduBufIndex + sduLoop];
                }
                SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
                
                /* assigned the specific ipdu buffer ptr into the static pointer. */
                rxIPduInfo.SduDataPtr = Com_RxDefIPduBuff;
                /* assigned the specific ipdu length value into the static variable. */
                rxIPduInfo.SduLength = Com_RxIPduRunTimeLength[ipduID];
    
                /* invoke signal Rx incation function. */
                Com_SignalRxIndication(ipduID, &rxIPduInfo);
    
                /* poll all the signal groups within this Ipdu */
                /* DL201425, DL201426 */
                for(signalID = rxIpduPbPtr->comSignalGroupIndexStart; signalID <= rxIpduPbPtr->comSignalGroupIndexStop; signalID++)
                {
                    /* invoke signal group Rx incation function. */
                    Com_SignalGroupRxIndication(COM_CFG_RXSIGNALGROUP_ID(signalID), &rxIPduInfo);
                }
                /* DL201425, DL201426 */

                /* DL201441 */
                Com_ClearFlagState((*rxIpduRtFlagPtr), COM_RT_RXIPDUFLAG_DEFERR_MASK);
                /* DL201441 */
            }  
        } 
    }

    return ;

    #undef SIGNALID
    #undef SIGNALGROUPID
    #undef SIGNALLTFLAG
    #undef SIGNAGRPLLTFLAG
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


/******************************************************************************/
/*
 * Brief               This function shall perform the processing of the AUTOSAR
 *                     COM transmission activities that are not directly initiated
                       by the calls from the RTE and PDU-R.
 * ServiceId           0x19
 * Sync/Async          None
 * Reentrancy          None
 * Param-Name[in]      None
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Fixed_Cyclic Task
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_MainFunctionTx(void)
{
    boolean txSendFlag;
    boolean mDTRunning = FALSE;
    uint16 txIPduLoop = 0;
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRtStatePtr = NULL_PTR;
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPbPtr = NULL_PTR;

    #if(STD_ON == COM_DEV_ERROR_DETECT)
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, COMSERVICEID_MAINFUNCTIONTX, COM_E_UNINIT);
        return ;
    }
    #endif

    /* loop all tx IPdu */
    for(txIPduLoop = 0u; txIPduLoop < COM_CONST_TXIPDU_NUM; txIPduLoop++)
    {
        /* IPdu Active */
        if(0u != Com_GetFlagState(Com_TxIPduRTimeFlag[txIPduLoop], COM_RT_TXIPDUFLAG_ACTIVE_MASK))
        {
            mDTRunning = FALSE;
            txSendFlag = FALSE;
            txIpduRtStatePtr = &(Com_TxIPduRTimeState[txIPduLoop]);
            txIpduPbPtr = &(COM_PTR_TXIPDUPB(txIPduLoop));
            /* Calculate DM, if DM > 0u, DM-- every mainfunction */
            if(txIpduRtStatePtr->txDMCntr > 0u)
            {
                txIpduRtStatePtr->txDMCntr--;
                /* DM_TimeOut */
                if(0u == txIpduRtStatePtr->txDMCntr)
                {
                    /* ToutNotification and CancelTx(Direct/N component) */
                    Com_TxDMTOutNotifMF(txIpduPbPtr)
                    Com_TxDMTOutCancelTx(txIPduLoop);
                }
            }   /* end of DM */

            /* Deferred TxConfimation */
            if(0u != Com_GetFlagState(Com_TxIPduRTimeFlag[txIPduLoop], COM_RT_TXIPDUFLAG_DEFERR_MASK))
            {
                Com_ConfirmationProcess(txIPduLoop);
                Com_ClearFlagState(Com_TxIPduRTimeFlag[txIPduLoop], COM_RT_TXIPDUFLAG_DEFERR_MASK);
            }   /* End of Deferred TxConfimation */

            /* Calculate MDT, if MDT > 0u, MDT-- every mainfunction  */
            if(txIpduRtStatePtr->txMDTCntr > 0u)
            {
                txIpduRtStatePtr->txMDTCntr--;

                /* MDT Timer > 0u, set MDT running flag */
                if(txIpduRtStatePtr->txMDTCntr != 0u)
                {
                    mDTRunning = TRUE;
                }
            }    /* End of MDT */

            /* Implement every txmode mainfunction, txmode based on TMSCntr
             * if TMSCntr > 0u, TxMode is TRUE,
             * if TMSCntr == 0u, TxMode is FALSE */
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            if(txIpduRtStatePtr->txTMSCntr > 0u)
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            {
                switch(COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxMode)
                {
                    case COM_TX_MODE_DIRECT:
                        txSendFlag = Com_MainFuncTxDirect(txIPduLoop, mDTRunning, TRUE);
                        break;

                    case COM_TX_MODE_MIXED:
                        txSendFlag = Com_MainFuncTxMixed(txIPduLoop, mDTRunning, TRUE);
                        break;

                    case COM_TX_MODE_PERIODIC:
                        txSendFlag = Com_MainFuncTxPeriod( txIPduLoop, mDTRunning
                                                                               /* SW201431 */
                                                                               #if (STD_ON == COM_FILTER_ENABLE)
                                                                               , TRUE
                                                                               #endif
                                                                               /* SW201431 */ );
                        break;

                    default:
                        break;
                }
            }
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            else if(0u == txIpduRtStatePtr->txTMSCntr)
            {
                switch(COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxMode)
                {
                    case COM_TX_MODE_DIRECT:
                        txSendFlag = Com_MainFuncTxDirect(txIPduLoop, mDTRunning, FALSE);
                        break;

                    case COM_TX_MODE_MIXED:
                        txSendFlag = Com_MainFuncTxMixed(txIPduLoop, mDTRunning, FALSE);
                        break;

                    case COM_TX_MODE_PERIODIC:
                        txSendFlag = Com_MainFuncTxPeriod( txIPduLoop, mDTRunning
                                                                               /* SW201431 */
                                                                               #if (STD_ON == COM_FILTER_ENABLE)
                                                                               , FALSE
                                                                               #endif
                                                                               /* SW201431 */ );
                        break;

                    default:
                        break;
                }
            }
            else{}
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            
            /* After mainfunction operation, this mainfunction need send ipdu */
            if(TRUE == txSendFlag)
            {
                PduInfoType pduInfo = {NULL_PTR, 0u};

                pduInfo.SduDataPtr = &Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex];
                pduInfo.SduLength = txIpduPbPtr->comIPduSize;
                
                if(E_OK == PduR_ComTransmit(txIpduPbPtr->comLowLayerPduId, &pduInfo))
                {
                    /* DL201422 */
                    #if(STD_ON == COM_UPDATEBIT_ENABLE)
                    /* Clear updatebit of this IPdu Signal & SignalGroup */
                    Com_ClearUpdatesInTxIPduMF(txIpduPbPtr)
                    #endif
                    /* DL201422 */
                }

                /* DL201415 */
                /* if sendout ipdu, clear DelayTx Flag */
                /* Com_ClearFlagState(Com_TxIPduRTimeFlag[txIPduLoop], COM_RT_TXIPDUFLAG_DELAY_MASK); */
                /* DL201415 */
            }
        }
    }
    
    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calls the signal gateway part of COM to forward received
 *                     signals to be routed. The insertion of this call is necessary
 *                     for decoupling receive interrupts and signal gateway tasks.
 * ServiceId           0x1a
 * Sync/Async          None
 * Reentrancy          None
 * Param-Name[in]      None
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Fixed_Cyclic Task
 */
/******************************************************************************/

#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_MainFunctionRouteSignals(void)
{
    /* DL201420 */
    #if (STD_ON == COM_GATEWAY_ENABLE)
    #if(STD_ON == COM_DEV_ERROR_DETECT)
    boolean detNoErr = TRUE;
    if(COM_INIT != Com_Status)
    {
        Det_ReportError(COM_MODULE_ID, COM_INSTANCE_ID, 
        COMSERVICEID_MAINFUNCTIONROUTESIGNALS, COM_E_UNINIT);
        detNoErr = FALSE;
    }
    if(FALSE == detNoErr)
    {
        return ;
    }
    #endif

    {
        uint16 gtwRxIpdu = 0;
        /* SW201439 */
        uint16 rxMapId;
        /* SW201439 */
        PduIdType gwRxIpduId = 0;
        P2CONST(Com_RxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
        rxIpduPbPtr = NULL_PTR;

        /* SW201445 */
        /* loop all gateway rx ipdus */
        for(gtwRxIpdu = 0; gtwRxIpdu < COM_CFG_GWRXIPDU_NUMBER; gtwRxIpdu++)
        {
            gwRxIpduId = COM_CFG_GWRXIPDUID(gtwRxIpdu);
            rxIpduPbPtr = &(COM_PTR_RXIPDUPB(gwRxIpduId));
    
            /* if the rx ipdu has signals or descriptions to be receiving-routed. */
            if(COM_RT_RXIPDUFLAG_NEEDGW_MASK == 
    		   Com_GetFlagState(Com_RxIPduRTimeFlag[gwRxIpduId], COM_RT_RXIPDUFLAG_NEEDGW_MASK))
            {		
                /* clear the needing routing flag for the rx ipdu. */
                Com_ClearFlagState(Com_RxIPduRTimeFlag[gwRxIpduId], COM_RT_RXIPDUFLAG_NEEDGW_MASK);
                /* SW201439 */
                /* loop all description/signal-map-ids for the rx ipdu. */
                for( rxMapId = rxIpduPbPtr->comSignalGwMapStart;
                      rxMapId <= rxIpduPbPtr->comSignalGwMapStop;
                      rxMapId++)
                {
                    /* SW201426 */
                    Com_GwyDSSrcMapHandle(rxMapId);
                    /* SW201426 */
                }
    
                /* loop all signal-group-map-ids for the rx ipdu. */
                for(rxMapId = rxIpduPbPtr->comSignalGroupGwMapStart;
                    rxMapId <= rxIpduPbPtr->comSignalGroupGwMapStop;
                    rxMapId++)
                {
                     /* SW201429 */
                     Com_GwySignalGrpSrcMapHandle(rxMapId);  
                     /* SW201429 */
                }
                /* SW201439 */
            }
        }
    }

    {
        uint16 gtwTxIpdu = 0;
        PduIdType gwTxIpduId = 0;
        PduInfoType PduInfo;
        P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
        txIpduPbPtr = NULL_PTR;
        
        /* loop all gateway tx ipdus */
        for(gtwTxIpdu = 0; gtwTxIpdu < COM_CFG_GWTXIPDU_NUMBER; gtwTxIpdu++)
        {
            gwTxIpduId = COM_CFG_GWTXIPDUID(gtwTxIpdu);
            txIpduPbPtr = &(COM_PTR_TXIPDUPB(gwTxIpduId));

            /* if the tx ipdu has signals or descriptions to be sending-routed. */
            if( COM_RT_TXIPDUFLAG_GWNEEDTX_MASK == 
            Com_GetFlagState(Com_TxIPduRTimeFlag[gwTxIpduId], COM_RT_TXIPDUFLAG_GWNEEDTX_MASK))
            {
                PduInfo.SduLength = txIpduPbPtr->comIPduSize;
                PduInfo.SduDataPtr = &(Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex]);
                
                if(E_OK == PduR_ComTransmit(txIpduPbPtr->comLowLayerPduId, &PduInfo))
                {
                    #if(STD_ON == COM_UPDATEBIT_ENABLE)
                    /* Clear updatebit of this IPdu Signal & SignalGroup */
                    Com_ClearUpdatesInTxIPduMF(txIpduPbPtr)
                    #endif
                }
                /* clear the needing routing flag for the tx ipdu. */
                Com_ClearFlagState(Com_TxIPduRTimeFlag[gwTxIpduId], COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);
            }
        }
    }
    /* SW201445 */

    /* DL201420 */
    #endif
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"



/******************************************************************************/
/*
 * Brief               By a call to Com_TpRxIndication the AUTOSAR COM module starts
 *                     the processing of the received large or dynamic length IPDU.
 * ServiceId           0x1e
 * Sync/Async          Synchronous
 * Reentrancy          Non reentrant for the same PDU-ID. Reentrant for different PDU-ID.
 * Param-Name[in]      PduId: ID of the AUTOSAR COM module's I-PDU that has been received.
 *                            Identifies the data that has been received.
 *                     Result: NTFRSLT_OK: the complete I-PDU has been received and is
 *                                         stored in the receive buffer.
 *                             <ANY OTHER VALUE>: the I-PDU has not been received; the
 *                                                receive buffer can be unlocked by the AUTOSAR
 *                                                COM.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Lower Layer
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_TpRxIndication(PduIdType PduId, NotifResultType Result)
{
    /* No Implement*/
    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               This function is called by the PduR after a large I-PDU has
 *                     been transmitted via the transport protocol on its network.
 * ServiceId           0x26
 * Sync/Async          Synchronous
 * Reentrancy          Non reentrant for the same PDU-ID. Reentrant for different PDU-ID.
 * Param-Name[in]      PduId: ID of the I-PDU that has been transmitted.
 *                     Result: Result of the transmission of the I-PDU.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Lower Layer
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(void, COM_CODE)
Com_TpTxConfirmation(PduIdType PduId, NotifResultType Result)
{
    /* No Implement*/
    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Com_StartOfReception returns the pointer to the size of the
 *                     AUTOSAR COM module's internal receive buffer for the I-PDU
 *                     with ID ComRxPduId.
 * ServiceId           0x25
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different PduIds. Non reentrant for the same PduId.
 * Param-Name[in]      ComRxPduId: ID of Tp I-PDU to be received.
 *                     TpSduLength: complete length of the TP I-PDU to be received.
 * Param-Name[out]     RxBufferSizePtr: Pointer to the size of internal TP-receive buffer.
 * Param-Name[in/out]  None
 * Return              BufReq_ReturnType: BUFREQ_OK: Connection has been accepted.
 *                                                   RxBufferSizePtr indicates the available
 *                                                   receive buffer.
 *                                        BUFREQ_E_NOT_OK: Connection has been rejected.
 *                                                         RxBufferSizePtr remains unchanged.
 *                                                         In case the configured buffer size
 *                                                         as specified via PduIdRef.PduLength
 *                                                         is smaller than TpSduLength.
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(BufReq_ReturnType, COM_CODE)
Com_StartOfReception
(
    PduIdType ComRxPduId,
    PduLengthType TpSduLength,
    PduLengthType *RxBufferSizePtr
)
{
    /* No Implement*/
    return BUFREQ_E_NOT_OK;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Called once upon reception of each segment.
 * ServiceId           0x23
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different PduIds. Non reentrant for the same PduId.
 * Param-Name[in]      PduId: ID of Tp I-PDU to be received.
 *                     PduInfoPointer: Pointer to a PduInfoType which indicates the number
 *                                     of bytes to be copied (SduLength) and the location of
 *                                     the source data (SduDataPtr).
 * Param-Name[out]     RxBufferSizePtr: Remaining receive buffer after completion of this call.
 * Param-Name[in/out]  None
 * Return              BufReq_ReturnType: BUFREQ_OK: Data has been copied to the receive buffer
 *                                                   completely as requested.
 *                                        BUFREQ_E_NOT_OK: Data has not been copied. Request failed.
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(BufReq_ReturnType, COM_CODE)
Com_CopyRxData
(
    PduIdType PduId,
    const PduInfoType *PduInfoPointer,
    PduLengthType *RxBufferSizePtr
)
{
    /* No Implement*/
    return BUFREQ_E_NOT_OK;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               At invocation of Com_CopyTxData the AUTOSAR COM module copy
 *                     the re-quested transmit data of the large IPDU with ID PduId
 *                     from its internal transmit buffer to the location specified by
 *                     the PduInfoPtr.
 * ServiceId           0x24
 * Sync/Async          Synchronous
 * Reentrancy          Reentrant for different PduIds. Non reentrant for the same PduId.
 * Param-Name[in]      PduId: ID of Tp I-PDU to be transmitted.
 *                     PduInfoPointer: Pointer to a PduInfoType, which indicates the number
 *                                     of bytes to be copied (SduLength) and the location
 *                                     where the data have to be copied to (SduDataPtr).
 *                     RetryInfoPtr: If the transmitted TP I-PDU does not support the retry
 *                                   feature a NULL_PTR can be provided.
 * Param-Name[out]     TxDataCntPtr: Remaining Tx data after completion of this call.
 * Param-Name[in/out]  None
 * Return              BufReq_ReturnType: BUFREQ_OK: Data has been copied to the receive buffer
 *                                                   completely as requested.
 *                                        BUFREQ_E_NOT_OK: Data has not been copied. Request failed,
 *                                                         in case the corresponding I-PDU was stopped.
 * PreCondition        None
 * CallByAPI           By RTE
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(BufReq_ReturnType, COM_CODE)
Com_CopyTxData
(
    PduIdType PduId,
    PduInfoType *PduInfoPtr,
    RetryInfoType *RetryInfoPtr,
    PduLengthType *TxDataCntPtr
)
{
    /* No Implement*/
    return BUFREQ_E_NOT_OK;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/* DL201434 */
/*=======[F U N C T I O N   I M P L E M E N T A T I O N S]====================*/
/******************************************************************************/
/*
 * Brief               Unpack RxSignal/RxGroupSignal/SourceDescription from IPdu, except Uint8N.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      pbFlag: Signal/GroupSignal/SourceDescription PBFlag.
 *                     lSBPosition: Signal/GroupSignal/SourceDescription LSB position in IPdu.
 *                     mSBPosition: Signal/GroupSignal/SourceDescription MSB position in IPdu.
 *                     rxIPduBuffer: Pointer to the IPduRuntimeBuffer.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint32: RxSignal/RxGroupSignal/SourceDescription value.
 * PreCondition        None
 * CallByAPI           By Com_RxIndication, Com_MainFuncitonRx, Com_MainFunctionRouteSignals
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(uint32, COM_CODE)
Com_RxUnPack
(
    uint8 pbFlag,
    uint16 lSBPosition,
    uint16 mSBPosition,
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) rxIPduBufferPtr
)
{
    uint32 rxData = 0uL;

    /* Signal is Boolean, Get Value From IPdu Directly */
    if(COM_RXSIGNAL_TYPE_BOOLEAN == Com_GetFlagState(pbFlag, COM_PBRXSIGNALTYPE_MASK))
    {
        rxData = Com_GetBitFrm8ByteArr(rxIPduBufferPtr, lSBPosition);
    }
    else
    {
        /* signal byte length in IPdu */
        uint16 rxSignalByteLength = 0u;

        /* signal/groupsignal/description value in rx Ipdu last byte */
        uint32 rxDataMSBByte = 0uL;

        /* Get First LSB byte from RxIPdu, whatever Big_Endianess or Little_Endianess */
        rxIPduBufferPtr = &(rxIPduBufferPtr[lSBPosition >> 3u]);

        /* Get signal byte length in IPdu */
        if(lSBPosition >= mSBPosition)
        {
            rxSignalByteLength = (lSBPosition >> 3u) - (mSBPosition >> 3u);
        }
        else
        {
            rxSignalByteLength = (mSBPosition >> 3u) - (lSBPosition >> 3u);
        }

        switch(rxSignalByteLength)
        {
            case COM_RT_SIGNALSPAN_0IPDUBYTE:
                break;

            case COM_RT_SIGNALSPAN_1IPDUBYTE:
                rxData = (uint32)(*rxIPduBufferPtr);

                /* Point Last IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                break;

            case COM_RT_SIGNALSPAN_2IPDUBYTE:
                rxData = (uint32)(*rxIPduBufferPtr);

                /* Point next IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                /* Get Second LSB Byte of rxData from IPdu */
                rxData |= (((uint32)(*rxIPduBufferPtr)) << 8u);

                /* Point Last IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                break;

            case COM_RT_SIGNALSPAN_3IPDUBYTE:
                rxData = (uint32)(*rxIPduBufferPtr);

                /* Point next IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                /* Get Second LSB Byte of rxData from IPdu */
                rxData |= (((uint32)(*rxIPduBufferPtr)) << 8u);

                /* Point next IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                /* Get Third LSB Byte of rxData from IPdu */
                rxData |= (((uint32)(*rxIPduBufferPtr)) << 16u);

                /* Point Last IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                break;

            case COM_RT_SIGNALSPAN_4IPDUBYTE:
                rxData = (uint32)(*rxIPduBufferPtr);

                /* Point next IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                /* Get Second LSB Byte of rxData from IPdu */
                rxData |= (((uint32)(*rxIPduBufferPtr)) << 8u);

                /* Point next IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                /* Get Third LSB Byte of rxData from IPdu */
                rxData |= (((uint32)(*rxIPduBufferPtr)) << 16u);

                /* Point next IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                /* Get fourth LSB Byte of rxData from IPdu */
                rxData |= (((uint32)(*rxIPduBufferPtr)) << 24u);

                /* Point Last IPdu Byte */
                Com_ToNextRxSignalByteInIPduMF(pbFlag, rxIPduBufferPtr)
                /* rxIPduBufferPtr--; */
                break;

            default:
                break;
        }

        /* Get MSB Byte Value */
        rxDataMSBByte = (uint32)((uint8)(((*rxIPduBufferPtr) & (0xFF >> (7u - (uint8)(mSBPosition & 0x07u))))));

        /* Flag Extension */
        switch(Com_GetFlagState(pbFlag, COM_PBRXSIGNALTYPE_MASK))
        {
            case COM_RXSIGNAL_TYPE_SINT8:
            case COM_RXSIGNAL_TYPE_SINT16:
            case COM_RXSIGNAL_TYPE_SINT32:
                if(0u < Com_GetBitFrm8ByteArr(rxIPduBufferPtr, (mSBPosition & 0x07uL)))
                {
                    /* need flag extension */
                    /* "0xFFFFFFFFuL << (mSBPosition & 0x07uL)" would reset MSB to 1, but it is already 1
                     * because "(0u < Com_GetBitFrm8ByteArr(rxIPduBufferPtr, (mSBPosition & 0x07uL))" */
                    rxDataMSBByte |= (0xFFFFFFFFuL << (mSBPosition & 0x07uL));
                }
                break;
            default:
                break;
        }

        /* And last byte value */
        switch(rxSignalByteLength)
        {
            case COM_RT_SIGNALSPAN_0IPDUBYTE:
                /* Flag Extension or not */
                if(rxDataMSBByte >= 0x80000000uL)
                {
                    rxData = 0xFF000000uL | (rxDataMSBByte >> (lSBPosition & (0x07uL)));
                }
                else
                {
                    rxData = rxDataMSBByte >> (lSBPosition & (0x07uL));
                }
                break;
            case COM_RT_SIGNALSPAN_1IPDUBYTE:
            case COM_RT_SIGNALSPAN_2IPDUBYTE:
            case COM_RT_SIGNALSPAN_3IPDUBYTE:
            case COM_RT_SIGNALSPAN_4IPDUBYTE:
                /* Shift RxData to delete unused bits less than LSB */
                rxData = rxData >> (lSBPosition & (0x07uL));

                rxData |= (rxDataMSBByte << ((rxSignalByteLength << 3u) - (lSBPosition & (0x07uL))));
                break;
            default:
                break;
        }
        /*rxData = rxData | (rxDataMSBByte << (32u - (lSBPosition & (0x07uL))));*/
    }

    return rxData;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


/******************************************************************************/
/*
 * Brief               Pack Signal/GroupSignal/Description value into IPdu, except Uint8N.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      pbFlag: Signal/GroupSignal/Description PBFlag
 *                     lSBPosition: Signal/GroupSignal/Description LSB Position in IPdu
 *                     mSBPosition: Signal/GroupSignal/Description MSB Position in IPdu
 *                     signalDataPtr: Pointer to the signal value
 *                     txIPduBufferPtr: Pointer to the txIPduBuffer
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_SendSignal, Com_TxPackSignalGroup, Com_MainFunctionRouteSignals
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxPack
(
    uint8 pbFlag,
    uint16 lSBPosition,
    uint16 mSBPosition,
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) signalDataPtr,
    P2VAR(uint8, AUTOMATIC, COM_VAR) txIPduBufferPtr
)
{
    uint32 txData = 0uL;

    /* convert value to uint32_signalData */
    switch(Com_GetFlagState(pbFlag, COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_BOOLEAN:
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_UINT8:
            txData = (uint32)(*((uint8*)signalDataPtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_UINT16:
            txData = (uint32)(*((uint16*)signalDataPtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT32:
        case COM_TXSIGNAL_TYPE_UINT32:
            txData = (uint32)(*((uint32*)signalDataPtr));
            break;

        default:
            break;
    }

    /* if signal/groupsignal/description is boolean, write IPdu bit directly */
    if(COM_TXSIGNAL_TYPE_BOOLEAN == Com_GetFlagState(pbFlag, COM_PBTXSIGNALTYPE_MASK))
    {
        if(txData > 0uL)
        {
            Com_SetBitTo8ByteArr(txIPduBufferPtr,lSBPosition);
        }
        else
        {
            Com_ClrBitFrm8ByteArr(txIPduBufferPtr,lSBPosition);
        }
    }
    else
    {
        /* signal byte length in IPdu */
        uint16 rxSignalByteLength = 0u;

        /* signal/groupsignal/description last byte value */
        uint32 rxDataMSBByte = txData;

        /* Point to txsignal LSB byte in IPdu */
        txIPduBufferPtr = &(txIPduBufferPtr[lSBPosition >> 3u]);

        /* Align LSB of txData and signal_value in IPdu */
        txData = txData << (lSBPosition & 0x07u);

        /* Get signal byte length in IPdu */
        if(lSBPosition >= mSBPosition)
        {
            rxSignalByteLength = (lSBPosition >> 3u) - (mSBPosition >> 3u);
        }
        else
        {
            rxSignalByteLength = (mSBPosition >> 3u) - (lSBPosition >> 3u);
        }

        switch(rxSignalByteLength)
        {
            case COM_RT_SIGNALSPAN_0IPDUBYTE:
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu >> (8u - (lSBPosition & 0x07u))) | (0xFFu << ((mSBPosition & 0x07u) + 1u));

                /* byteMask <=> (0xFF >> (7u - (mSBPosition & 0x07u)));*/
                *txIPduBufferPtr |= (uint8)((0xFF >> (7u - (mSBPosition & 0x07u))) & ((uint8)txData));
                break;

            case COM_RT_SIGNALSPAN_1IPDUBYTE:
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu >> (8u - (lSBPosition & 0x07u)));
                /* write LSB byte in IPdu */
                *txIPduBufferPtr |= ((uint8)(txData));

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move LSB Byte out of txData */
                txData = txData >> 8u;
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu << ((mSBPosition & 0x07u) + 1u));
                /* write MSB byte in IPdu */
                *txIPduBufferPtr |= ((uint8)(txData)) & (0xFFu >> (7u - (mSBPosition & 0x07u)));
                break;

            case COM_RT_SIGNALSPAN_2IPDUBYTE:
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu >> (8u - (lSBPosition & 0x07u)));
                /* write LSB byte in IPdu */
                *txIPduBufferPtr |= ((uint8)(txData));

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move LSB Byte out of txData */
                txData = txData >> 8u;
                /* write txIPduBuffer next byte directly by copy value */
                *txIPduBufferPtr = (uint8)(txData);

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move MSB byte to txData last byte */
                txData = txData >> 8u;
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu << ((mSBPosition & 0x07u) + 1u));
                /* write MSB byte in IPdu */
                *txIPduBufferPtr |= (uint8)(txData) & (0xFFu >> (7u - (mSBPosition & 0x07u)));
                break;

            case COM_RT_SIGNALSPAN_3IPDUBYTE:
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu >> (8u - (lSBPosition & 0x07u)));
                /* write LSB byte in IPdu */
                *txIPduBufferPtr |= ((uint8)(txData));

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move LSB Byte out of txData */
                txData = txData >> 8u;
                /* write txIPduBuffer next byte directly by copy value */
                *txIPduBufferPtr = (uint8)(txData);

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move next Byte out of txData */
                txData = txData >> 8u;
                /* write txIPduBuffer next byte directly by copy value */
                *txIPduBufferPtr = (uint8)(txData);

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move MSB byte to txData last byte */
                txData = txData >> 8u;
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= 0xFFu << ((mSBPosition & 0x07u) + 1u);
                /* write MSB byte in IPdu */
                *txIPduBufferPtr |= (uint8)(txData) & (0xFFu >> (7u - (mSBPosition & 0x07u)));
                break;

            case COM_RT_SIGNALSPAN_4IPDUBYTE:
                /* Clear corresponding bits in IPdu */
                *txIPduBufferPtr &= (0xFFu >> (8u - (lSBPosition & 0x07u)));
                /* write LSB byte in IPdu */
                *txIPduBufferPtr |= ((uint8)(txData));

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move LSB Byte out of txData */
                txData = txData >> 8u;
                /* write txIPduBuffer next byte directly by copy value */
                *txIPduBufferPtr = (uint8)(txData);

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move next Byte out of txData */
                txData = txData >> 8u;
                /* write txIPduBuffer next byte directly by copy value */
                *txIPduBufferPtr = (uint8)(txData);

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* move next Byte out of txData */
                txData = txData >> 8u;
                /* write txIPduBuffer next byte directly by copy value */
                *txIPduBufferPtr = (uint8)(txData);

                /* To next SignalByte in IPdu */
                Com_ToNextTxSignalByteInIPduMF(pbFlag, txIPduBufferPtr)
                /* Get MSB Byte value */
                rxDataMSBByte = rxDataMSBByte >> (32u - (lSBPosition & 0x07u));
                /* clear txIPduBuffer MSB byte */
                *txIPduBufferPtr &= 0xFFu << ((mSBPosition & 0x07u) + 1u);
                /* write txIPduBuffer MSB byte */
                *txIPduBufferPtr |= (uint8)(rxDataMSBByte) & (0xFFu >> (7u - (mSBPosition & 0x07u)));
                break;
            default:
                break;
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Pack signal group into IPdu.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group.
 * Param-Name[in]      txSignalGroupId: Signal group Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_SendSignalGroup
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxPackSignalGroup(Com_SignalGroupIdType txSignalGroupId)
{
    uint16 cirCnt = 0u;
    P2CONST(Com_TxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txGrpSignalPbPtr = NULL_PTR;
    P2VAR(uint8, AUTOMATIC, COM_VAR)
    txIpduRtBuffPtr = NULL_PTR;

    for(cirCnt = Com_TxSignalGroupLT[txSignalGroupId].comTxGroupSignalIndexStart;
        cirCnt <= Com_TxSignalGroupLT[txSignalGroupId].comTxGroupSignalIndexStop; cirCnt++)
    {
        txIpduRtBuffPtr = &Com_TxIPduRuntimeBuff[COM_PTR_TXIPDUPB(COM_PTR_TXSIGGRPPB(txSignalGroupId).comIPduRefIndex).comTxIPduBufIndex];
        txGrpSignalPbPtr = &(COM_PTR_TXGRPSIGPB(cirCnt));

        switch(Com_GetFlagState(txGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBTXSIGNALTYPE_MASK))
        {
            case COM_TXSIGNAL_TYPE_BOOLEAN:
                Com_TxPack(txGrpSignalPbPtr->comGroupSignalPBFlag, 
					    txGrpSignalPbPtr->comGroupSignalLSBPos, 
					    txGrpSignalPbPtr->comGroupSignalMSBPos,
                                    &Com_SignalBoolRuntimeBuff[txGrpSignalPbPtr->comGroupSignalBufIndex], 
                                    txIpduRtBuffPtr);
                break;

            case COM_TXSIGNAL_TYPE_SINT8:
            case COM_TXSIGNAL_TYPE_UINT8:
                Com_TxPack(txGrpSignalPbPtr->comGroupSignalPBFlag, 
					    txGrpSignalPbPtr->comGroupSignalLSBPos, 
					    txGrpSignalPbPtr->comGroupSignalMSBPos,
                                    &Com_Signal8BitRuntimeBuff[txGrpSignalPbPtr->comGroupSignalBufIndex],
                                    txIpduRtBuffPtr);
                break;

            case COM_TXSIGNAL_TYPE_SINT16:
            case COM_TXSIGNAL_TYPE_UINT16:
                Com_TxPack(txGrpSignalPbPtr->comGroupSignalPBFlag, 
					    txGrpSignalPbPtr->comGroupSignalLSBPos, 
					    txGrpSignalPbPtr->comGroupSignalMSBPos,
                                    &Com_Signal16BitRuntimeBuff[txGrpSignalPbPtr->comGroupSignalBufIndex],
                                    txIpduRtBuffPtr);
                break;

            case COM_TXSIGNAL_TYPE_SINT32:
            case COM_TXSIGNAL_TYPE_UINT32:
                Com_TxPack(txGrpSignalPbPtr->comGroupSignalPBFlag, 
                                    txGrpSignalPbPtr->comGroupSignalLSBPos,
                                    txGrpSignalPbPtr->comGroupSignalMSBPos,
                                    &Com_Signal32BitRuntimeBuff[txGrpSignalPbPtr->comGroupSignalBufIndex],
                                    txIpduRtBuffPtr);
                break;

            case COM_TXSINGAL_TYPE_UNIT8_N:
                /* DL201425 */
                Com_U8NGrpSignalPack(cirCnt);
                break;

            default:
                break;
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* DL201434 */

/******************************************************************************/
/*
 * Brief               Pack uint8N signal into IPdu.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      txSignalId: Signal Id.
 *                     SignalPtr: Pointer to the signal value.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Signal value is changed or not.
 * PreCondition        None
 * CallByAPI           By Com_SendSignalGroup
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201459 */
STATIC FUNC(boolean, COM_CODE)
Com_U8NSignalPack
(
    Com_SignalIdType txSignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalPtr
)
{
    #define  TX_SIGNAL_VALUE_IND (COM_PTR_TXSIGNALPB(txSignalId).comSignalBufIndex)

    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSignalPbPtr = &(COM_PTR_TXSIGNALPB(txSignalId));
    uint16 txIpduValueStartIndSig = COM_PTR_TXIPDUPB(txSignalPbPtr->comIPduRefIndex).comTxIPduBufIndex
                                     + txSignalPbPtr->comSignalLSBPos;
   

    uint16 cirCnt = 0u;
    boolean rtnVal = FALSE;

    /* DL201434 */
    uint8 signalSize = 0u;

    if(txSignalPbPtr->comSignalLSBPos < txSignalPbPtr->comSignalMSBPos)
    {
        signalSize = (uint8)((txSignalPbPtr->comSignalMSBPos - txSignalPbPtr->comSignalLSBPos) + 1u);
    }
    else
    {
        signalSize = (uint8)((txSignalPbPtr->comSignalLSBPos - txSignalPbPtr->comSignalMSBPos) + 1u);
    }
    /* DL201434 */

    /* copy value from signalptr to siganl runtime buffer and TxIPduRuntimeBuffer */
    /* DL201431 */
    if(COM_TXSIGNAL_ENDIANESS_BIG
       == Com_GetFlagState(txSignalPbPtr->comSignalPBFlag, COM_PBTXSIGENDIANESS_MASK))
    {
        for(cirCnt = 0u; cirCnt < signalSize; cirCnt++)
        {
            if((((uint8*)SignalPtr)[cirCnt])!=(Com_Signal8BitRuntimeBuff[TX_SIGNAL_VALUE_IND - cirCnt]))
            {
                Com_Signal8BitRuntimeBuff[TX_SIGNAL_VALUE_IND - cirCnt] = ((uint8*)SignalPtr)[cirCnt];
                rtnVal = TRUE;
            }
            Com_TxIPduRuntimeBuff[txIpduValueStartIndSig - cirCnt] = ((uint8*)SignalPtr)[cirCnt];
        }
    }
    else
    {
        for(cirCnt = 0u; cirCnt < signalSize; cirCnt++)
        {
            if((((uint8*)SignalPtr)[cirCnt])!=(Com_Signal8BitRuntimeBuff[TX_SIGNAL_VALUE_IND + cirCnt]))
            {
                Com_Signal8BitRuntimeBuff[TX_SIGNAL_VALUE_IND + cirCnt] = ((uint8*)SignalPtr)[cirCnt];
                rtnVal = TRUE;
            }
            Com_TxIPduRuntimeBuff[txIpduValueStartIndSig + cirCnt] = ((uint8*)SignalPtr)[cirCnt];
        }
    }
    /* DL201431 */

    /* signal value is changed or not */
    return rtnVal;
    #undef TX_SIGNAL_VALUE_IND
    
}
/* SW201459 */
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Pack uint8N group signal into IPdu.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      txSignalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_TxPackSignalGroup.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201459 */
STATIC FUNC(void, COM_CODE)
Com_U8NGrpSignalPack(Com_SignalIdType txSignalId)
{
    #define TX_GRPSIG_VALUE_IND (txGrpSignalPbPtr->comGroupSignalBufIndex)

    P2CONST(Com_TxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txGrpSignalPbPtr = &(COM_PTR_TXGRPSIGPB(txSignalId));
    uint16 txIpduValueStartIndGS = txGrpSignalPbPtr->comGroupSignalLSBPos + 
             COM_CFG_TXIPDU_BUFFINDEX(COM_CFG_TXSIGNALGROUP_IPDUIDREF(Com_TxGroupSignalLT[txSignalId].comSignalGroupRef));
    uint16 cirCnt = 0u;

    /* DL201434 */
    uint8 signalSize = 0u;

    if(txGrpSignalPbPtr->comGroupSignalLSBPos < txGrpSignalPbPtr->comGroupSignalMSBPos)
    {
        signalSize = (uint8)((txGrpSignalPbPtr->comGroupSignalMSBPos - txGrpSignalPbPtr->comGroupSignalLSBPos) + 1u);
    }
    else
    {
        signalSize = (uint8)((txGrpSignalPbPtr->comGroupSignalLSBPos - txGrpSignalPbPtr->comGroupSignalMSBPos) + 1u);
    }
    /* DL201434 */

    /* copy value from IPduBuffer to signal buffer */
    /* DL201431 */
    if(COM_TXSIGNAL_ENDIANESS_BIG
            == Com_GetFlagState(txGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBTXSIGENDIANESS_MASK))
    {
        for(cirCnt = 0u; cirCnt < signalSize; cirCnt++)
        {
            Com_TxIPduRuntimeBuff[txIpduValueStartIndGS - cirCnt] =
            Com_Signal8BitRuntimeBuff[TX_GRPSIG_VALUE_IND + cirCnt];
        }
    }
    else
    {
        for(cirCnt = 0u; cirCnt < signalSize; cirCnt++)
        {
            Com_TxIPduRuntimeBuff[txIpduValueStartIndGS + cirCnt] =
            Com_Signal8BitRuntimeBuff[TX_GRPSIG_VALUE_IND + cirCnt];
        }
    }
    /* DL201431 */

    return ;
    
    #undef TX_GRPSIG_VALUE_IND
}
/* SW201459 */
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


#if (STD_ON == COM_FILTER_ENABLE)
/******************************************************************************/
/*
 * Brief               Calculate IPdu TMS based on signal value.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      txSignalId: Signal Id.
 *                     signalValuePtr: Pointer to the signal value.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Tx IPdu TMS is changed or not.
 * PreCondition        None
 * CallByAPI           By Com_SendSignal.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSignalTMSHandle
(
    Com_SignalIdType txSignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) signalValuePtr
)
{
    boolean ret = FALSE;
    uint32 signalNewValue = 0u;
    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSignaPbPtr = &(COM_PTR_TXSIGNALPB(txSignalId));

    /* get signal new value based on signal type, uint8N_Filter is only Always or Never,
     * no matter what value it is.
     */
    switch(Com_GetFlagState(txSignaPbPtr->comSignalPBFlag, COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_BOOLEAN:
            signalNewValue = (uint32)(*((boolean*)signalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_UINT8:
            signalNewValue = (uint32)(*((uint8*)signalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_UINT16:
            signalNewValue = (uint32)(*((uint16*)signalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT32:
        case COM_TXSIGNAL_TYPE_UINT32:
            signalNewValue = (uint32)(*((uint32*)signalValuePtr));
            break;

        default:
            break;
    }

    {
        boolean filterFncRet = FALSE;
        P2VAR(uint16_least, AUTOMATIC, COM_VAR)
        txIpduRtTmsCntrPtr = &(Com_TxIPduRTimeState[txSignaPbPtr->comIPduRefIndex].txTMSCntr);
        P2VAR(Com_TxSignalLastTMCRTType, AUTOMATIC, COM_VAR)
        txSignalRtLastTmcPtr = &(Com_TxSignalRTimeLastTMC[Com_TxSignalLT[txSignalId].comTMCIndex]);
        /* Calculate filter result */
        filterFncRet = Com_FilterFunctionArray[txSignaPbPtr->comFilterFuncIndex](signalNewValue, txSignalId);
    
        /* Tx Signal TMC TRUE->FALSE */
        if(FALSE == filterFncRet)
        {
            /* tx signal last filter result is TRUE */
            if(TRUE == (*txSignalRtLastTmcPtr))
            {
                (*txIpduRtTmsCntrPtr)--;
                /* signal TMC TRUE->FALSE, IPdu TMS cntr--, assign signal last TMC, TMC Changed */
                if(0 == (*txIpduRtTmsCntrPtr))
                {
                    ret = TRUE;
                }  
                *txSignalRtLastTmcPtr = FALSE;
            }
        }
        else  /* Tx Signal TMC FALSE->TRUE */
        {
            /* tx signal last filter result is FALSE */
            if(FALSE == (*txSignalRtLastTmcPtr))
            {
                if(0 ==(*txIpduRtTmsCntrPtr))
                {
                    ret = TRUE;
                }
                (*txIpduRtTmsCntrPtr)++;
                /* signal TMC FALSE->TRUE, IPdu TMS cntr++, assign signal last TMC, TMC Changed */ 
                *txSignalRtLastTmcPtr = TRUE; 
            }
            
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate IPdu TMS based on signal group TMC.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group.
 * Param-Name[in]      txSignalGroupId: Signal group Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Tx IPdu TMS is changed or not.
 * PreCondition        None
 * CallByAPI           By Com_SendSignalGroup.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSignalGroupTMSHandle(Com_SignalGroupIdType txSignalGroupId)
{
    boolean ret = FALSE;
    PduIdType txSignalGrpPbIpduRefInd = COM_PTR_TXSIGGRPPB(txSignalGroupId).comIPduRefIndex;
    P2VAR(uint16_least, AUTOMATIC, COM_VAR)
    txIpduRtTmsCntrPtr = &(Com_TxIPduRTimeState[txSignalGrpPbIpduRefInd].txTMSCntr);
    P2VAR(Com_TxSignalGroupLastTMCRTType, AUTOMATIC, COM_VAR)
    txSignalGrpRtLastTmcPtr = &(Com_TxSignalGroupRTimeLastTMC[Com_TxSignalGroupLT[txSignalGroupId].comTMCIndex]);

    /* TX SignalGroup TMC TRUE->FALSE */
    if(0u == Com_TxSignalGroupRTimeTMCCntr[Com_TxSignalGroupLT[txSignalGroupId].comTMCIndex])
    {
        /* tx signal last filter result is TRUE */
        if(TRUE == (*txSignalGrpRtLastTmcPtr))
        {
            /* signal TMC TRUE->FALSE, IPdu TMS cntr--, assign signal last TMC, TMC Changed */
            (*txIpduRtTmsCntrPtr)--;
            if(0 == (*txIpduRtTmsCntrPtr))
            {
                ret = TRUE; 
            }
            *txSignalGrpRtLastTmcPtr = FALSE; 
        }
    }
    else  /* Tx Signal TMC FALSE->TRUE */
    {
        /* tx signal last filter result is FALSE */
        if(FALSE == (*txSignalGrpRtLastTmcPtr))
        {
            if(0 == (*txIpduRtTmsCntrPtr))
            {
                ret = TRUE;
            }
            (*txIpduRtTmsCntrPtr)++;
            /* signal TMC FALSE->TRUE, IPdu TMS cntr++, assign signal last TMC, TMC Changed */
            *txSignalGrpRtLastTmcPtr = TRUE;   
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate signal group TMC based on group signal value.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      txGroupSignalId: Group signal Id.
 *                     groupSignalValuePtr: Pointer to the group signal value.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_UpdateShadowSignal.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxSignalGroupTMCHandle
(
    Com_SignalIdType txGroupSignalId, 
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) groupSignalValuePtr
)
{
    boolean filterFncRet = FALSE;
    uint32 groupSignalNewValue = 0u;
    P2VAR(Com_TxGroupSignalLastTMCRTType, AUTOMATIC, COM_VAR)
    txGrpSignalRtLastTmcPtr = &(Com_TxGrpSigRTimeLastTMC[Com_TxGroupSignalLT[txGroupSignalId].comTMCIndex]);

    /* get tx group signal new value based on group signal type, uint8N_Filter is only Always or Never,
     * no matter what value it is.
     */
    switch(Com_GetFlagState(COM_CFG_TXGRPSIG_PBFLAG(txGroupSignalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_BOOLEAN:
            groupSignalNewValue = (uint32)(*((boolean*)groupSignalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_UINT8:
            groupSignalNewValue = (uint32)(*((uint8*)groupSignalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_UINT16:
            groupSignalNewValue = (uint32)(*((uint16*)groupSignalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT32:
        case COM_TXSIGNAL_TYPE_UINT32:
            groupSignalNewValue = (uint32)(*((uint32*)groupSignalValuePtr));
            break;

        default:
            break;
    }

    /* Calculate filter result */
    filterFncRet = Com_FilterFunctionArray[COM_CFG_TXGRPSIG_FILTERFNCINDEX(txGroupSignalId)](groupSignalNewValue,txGroupSignalId);

    /* GroupSignal Filter FALSE->TRUE */
    if(TRUE == filterFncRet)
    {
        /* tx group signal last filter result is FALSE */
        if(FALSE == (*txGrpSignalRtLastTmcPtr))
        {
            /* group signal TMC FALSE->TRUE, signal group cntr++, assign group signal last TMC */
            Com_TxSignalGroupRTimeTMCCntr[Com_TxSignalGroupLT[Com_TxGroupSignalLT[txGroupSignalId].comSignalGroupRef].comTMCIndex]++;
            (*txGrpSignalRtLastTmcPtr) = TRUE;
        }
    }
    else   /* GroupSignal Filter TRUE->FALSE */
    {
        /* tx group signal last filter result is TRUE */
        if(TRUE == (*txGrpSignalRtLastTmcPtr))
        {
            /* group signal TMC TRUE->FALSE, signal group cntr--, assign group signal last TMC */
            Com_TxSignalGroupRTimeTMCCntr[Com_TxSignalGroupLT[Com_TxGroupSignalLT[txGroupSignalId].comSignalGroupRef].comTMCIndex]--;
            (*txGrpSignalRtLastTmcPtr) = FALSE;
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of Always(always TRUE).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, or same group signal.
 * Param-Name[in]      newValue: Signal or group signal value.
 *                     signalId: Signal or group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By filter & TMC calculate.
 */
/******************************************************************************/
/* MISRA-C: Because this Function is belonged to one Function Array, others need these two input. */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_FAlways(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter is always true */
    return TRUE;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of Never(always FALSE).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, or same group signal.
 * Param-Name[in]      newValue: Signal or group signal value.
 *                     signalId: Signal or group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By filter & TMC calculate.
 */
/******************************************************************************/
/* MISRA-C: Because this Function is belonged to one Function Array, others need these two input. */
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_FNever(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter is always FALSE */
    return FALSE;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of MaskedNewEqualsX((new_value&mask) == x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) == x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[Com_RxSignalLT[signalId].comFilterIndex].comFilterPara1))
        == (Com_Filter[Com_RxSignalLT[signalId].comFilterIndex].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of MaskedNewDiffersX((new_value&mask) != x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[Com_RxSignalLT[signalId].comFilterIndex].comFilterPara1))
        != (Com_Filter[Com_RxSignalLT[signalId].comFilterIndex].comFilterPara2))
    {
         ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of NewIsWithin(min <= new_value <= max).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFNewIsWithin(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: min <= new_value <= max */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_RxSignalLT[signalId].comFilterIndex]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_RXSIGNAL_PBFLAG(signalId), COM_PBRXSIGNALTYPE_MASK))
    {
        case COM_RXSIGNAL_TYPE_SINT8:
        case COM_RXSIGNAL_TYPE_SINT16:
        case COM_RXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) <= ((sint32)(filterPtr->comFilterPara1)))
                && (((sint32)(newValue)) >= ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_RXSIGNAL_TYPE_UINT8:
        case COM_RXSIGNAL_TYPE_UINT16:
        case COM_RXSIGNAL_TYPE_UINT32:
            if(((newValue) <= (filterPtr->comFilterPara1))
                && ((newValue) >= (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of NewIsOutside((min > new_value)
 *                                                      OR (new_value > max)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFNewIsOutside(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (min > new_value) OR (new_value > max) */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_RxSignalLT[signalId].comFilterIndex]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_RXSIGNAL_PBFLAG(signalId), COM_PBRXSIGNALTYPE_MASK))
    {
        case COM_RXSIGNAL_TYPE_SINT8:
        case COM_RXSIGNAL_TYPE_SINT16:
        case COM_RXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) > ((sint32)(filterPtr->comFilterPara1)))
                || (((sint32)(newValue)) < ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_RXSIGNAL_TYPE_UINT8:
        case COM_RXSIGNAL_TYPE_UINT16:
        case COM_RXSIGNAL_TYPE_UINT32:
            if(((newValue) > (filterPtr->comFilterPara1))
                || ((newValue) < (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate filter of OneEveryN(occurrence % period == offset).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxFOneEveryN(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: OCCURRENCE == OFFSET */
    boolean ret = FALSE;
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[signalId]);

    /* FILTER shall be set true when OCCURRENCE == OFFSET */
    /* DL201401 */
    if((Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
        == Com_RxSignalRTimeOccurenceCntr[rxSignalLtPtr->comFilterOccurceIndex])
    {
        ret = TRUE;
    }
    /* DL201401 */

    /* OCCURRENCE shall be incremented after filter processing */
    /* DL201401 */
    Com_RxSignalRTimeOccurenceCntr[rxSignalLtPtr->comFilterOccurceIndex]++;
    /* DL201401 */

    /* When OCCURRENCE == PERIOD, OCCURRENCE shall be set to zero */
    /* DL201401 */
    if((Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara2)
        == Com_RxSignalRTimeOccurenceCntr[rxSignalLtPtr->comFilterOccurceIndex])
    {
        /* DL201401 */
        Com_RxSignalRTimeOccurenceCntr[rxSignalLtPtr->comFilterOccurceIndex] = 0u;
    }
    /* DL201401 */

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate boolean filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_RxBoolFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != (old_value&mask) */
    boolean ret = FALSE;
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[signalId]);

    /* no NOB Signal, old value is stored in RTimeSignal Buffer */
    if(0u == rxSignalLtPtr->comSignalDMTOut)
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_SignalBoolRuntimeBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }
    else   /* NOB Signal, old value is stored in RTimeNOBOldSignal Buffer */
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_RxSignalNOBBoolRtimeOldBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint8 or sint8 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_Rx8BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != (old_value&mask) */
    boolean ret = FALSE;
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[signalId]);

    /* no NOB Signal, old value is stored in RTimeSignal Buffer */
    if(0u == rxSignalLtPtr->comSignalDMTOut)
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_Signal8BitRuntimeBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }
    else    /* NOB Signal, Old value is stored in RTimeNOBOldSignal Buffer */
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_RxSignalNOB8BitRtimeOldBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint16 or sint16 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_Rx16BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != (old_value&mask) */
    boolean ret = FALSE;
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[signalId]);

    /* no NOB Signal, old value is stored in RTimeSignal Buffer */
    if(0u == rxSignalLtPtr->comSignalDMTOut)
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_Signal16BitRuntimeBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }
    else    /* NOB Signal, Old value is stored in RTimeNOBOldSignal Buffer */
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_RxSignalNOB16BitRtimeOldBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint32 or sint32 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By Rx_filter.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_Rx32BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != (old_value&mask) */
    boolean ret = FALSE;
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[signalId]);

    /* no NOB Signal, old value is stored in RTimeSignal Buffer */
    if(0u == rxSignalLtPtr->comSignalDMTOut)
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_Signal32BitRuntimeBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }
    else    /* NOB Signal, Old value is stored in RTimeNOBOldSignal Buffer */
    {
        if((newValue & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1)
            != (Com_RxSignalNOB32BitRtimeOldBuff[COM_CFG_RXSIGNAL_VALUEINDEX(signalId)]
                 & Com_Filter[rxSignalLtPtr->comFilterIndex].comFilterPara1))
        {
            ret = TRUE;
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate MaskedNewEqualsX((new_value&mask) == x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) == x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1))
        == (Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate MaskedNewEqualsX((new_value&mask) == x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) == x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1))
        == (Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate MaskedNewDiffersX((new_value&mask) != x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1))
        != (Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate MaskedNewDiffersX((new_value&mask) != x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1))
        != (Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate NewIsWithin(min <= new_value <= max).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFNewIsWithin(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: min <= new_value <= max */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_TxSignalLT[signalId].comFilterIndex]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_TXSIGNAL_PBFLAG(signalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) <= ((sint32)(filterPtr->comFilterPara1)))
                && (((sint32)(newValue)) >= ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSIGNAL_TYPE_UINT16:
        case COM_TXSIGNAL_TYPE_UINT32:
            if(((newValue) <= (filterPtr->comFilterPara1))
                && ((newValue) >= (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate NewIsWithin(min <= new_value <= max).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFNewIsWithin(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: min <= new_value <= max */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_TXGRPSIG_PBFLAG(signalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) <= ((sint32)(filterPtr->comFilterPara1)))
                && (((sint32)(newValue)) >= ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSIGNAL_TYPE_UINT16:
        case COM_TXSIGNAL_TYPE_UINT32:
            if(((newValue) <= (filterPtr->comFilterPara1))
                && ((newValue) >= (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate NewIsOutside((min > new_value)
 *                                            OR (new_value > max)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFNewIsOutside(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (min > new_value) OR (new_value > max) */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_TxSignalLT[signalId].comFilterIndex]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_TXSIGNAL_PBFLAG(signalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) > ((sint32)(filterPtr->comFilterPara1)))
                || (((sint32)(newValue)) < ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSIGNAL_TYPE_UINT16:
        case COM_TXSIGNAL_TYPE_UINT32:
            if(((newValue) > (filterPtr->comFilterPara1))
                || ((newValue) < (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate NewIsOutside((min > new_value)
 *                                            OR (new_value > max)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFNewIsOutside(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (min > new_value) OR (new_value > max) */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_TXGRPSIG_PBFLAG(signalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) > ((sint32)(filterPtr->comFilterPara1)))
                || (((sint32)(newValue)) < ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSIGNAL_TYPE_UINT16:
        case COM_TXSIGNAL_TYPE_UINT32:
            if(((newValue) > (filterPtr->comFilterPara1))
                || ((newValue) < (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate OneEveryN(occurrence % period == offset).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigFOneEveryN(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: OCCURRENCE == OFFSET */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[Com_TxSignalLT[signalId].comFilterIndex]);
    P2VAR(Com_SignalFOccureRTType, AUTOMATIC, COM_VAR)
    txSignalRtOccCntrPtr = &(Com_TxSignalRTimeOccurenceCntr[Com_TxSignalLT[signalId].comFilterOccurceIndex]);

    /* FILTER shall be set true when OCCURRENCE == OFFSET */
    /* DL201401 */
    if((filterPtr->comFilterPara1) == (*txSignalRtOccCntrPtr))
    {
        ret = TRUE;
    }
    /* DL201401 */

    /* OCCURRENCE shall be incremented after filter processing */
    /* DL201401 */
    (*txSignalRtOccCntrPtr)++;
    /* DL201401 */

    /* When OCCURRENCE == PERIOD, OCCURRENCE shall be set to zero */
    /* DL201401 */
    if((filterPtr->comFilterPara2) == (*txSignalRtOccCntrPtr))
    {
        /* DL201401 */
        (*txSignalRtOccCntrPtr) = 0u;
    }
    /* DL201401 */

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate OneEveryN(occurrence % period == offset).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSFOneEveryN(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: OCCURRENCE == OFFSET */
    boolean ret = FALSE;
    P2VAR(Com_SignalFOccureRTType, AUTOMATIC, COM_VAR)
    txGrpSignalRtOccCntrPtr = &(Com_TxGrpSigRTimeOccurenceCntr[Com_TxGroupSignalLT[signalId].comFilterOccurceIndex]);


    /* FILTER shall be set true when OCCURRENCE == OFFSET */
    /* DL201401 */
    if((Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1)
        == (*txGrpSignalRtOccCntrPtr))
    {
        ret = TRUE;
    }
    /* DL201401 */

    /* OCCURRENCE shall be incremented after filter processing */
    /* DL201401 */
    (*txGrpSignalRtOccCntrPtr)++;
    /* DL201401 */

    /* When OCCURRENCE == PERIOD, OCCURRENCE shall be set to zero */
    /* DL201401 */
    if((Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara2)
        == (*txGrpSignalRtOccCntrPtr))
    {
        /* DL201401 */
        (*txGrpSignalRtOccCntrPtr) = 0u;
    }
    /* DL201401 */

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate boolean filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSigBoolFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_SignalBoolRuntimeBuff[COM_CFG_TXSIGNAL_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate boolean filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGSBoolFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_SignalBoolRuntimeBuff[COM_CFG_TXGRPSIG_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint8 or sint8 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSig8BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_Signal8BitRuntimeBuff[COM_CFG_TXSIGNAL_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint8 or sint8 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGS8BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_Signal8BitRuntimeBuff[COM_CFG_TXGRPSIG_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint16 or sint16 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSig16BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_Signal16BitRuntimeBuff[COM_CFG_TXSIGNAL_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint16 or sint16 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGS16BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_Signal16BitRuntimeBuff[COM_CFG_TXGRPSIG_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint32 or sint32 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Signal value.
 *                     signalId: Signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxSig32BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_Signal32BitRuntimeBuff[COM_CFG_TXSIGNAL_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}

/******************************************************************************/
/*
 * Brief               Calculate uint32 or sint32 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      newValue: Group signal value.
 *                     signalId: Group signal Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_TxGS32BitFMaskNewDifMaskOld(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1)
        != (Com_Signal32BitRuntimeBuff[COM_CFG_TXGRPSIG_VALUEINDEX(signalId)]
             & Com_Filter[Com_TxGroupSignalLT[signalId].comFilterIndex].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

#endif

/* DL201429 */
#if((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
/******************************************************************************/
/*
 * Brief               Calculate MaskedNewEqualsX((new_value&mask) == x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFMaskNewEquX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) == x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1))
        == (Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate MaskedNewDiffersX((new_value&mask) != x).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFMaskNewDifX(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (new_value&mask) != x */
    boolean ret = FALSE;
    if(((newValue) & (Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1))
        != (Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara2))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate NewIsWithin(min <= new_value <= max).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFNewIsWithin(uint32 newValue, Com_SignalIdType signalId)
{

    /* filter: min <= new_value <= max */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_GWDESTDESC_FLAG(signalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_SINT32:
            if( (((sint32)(newValue)) <= ((sint32)(filterPtr->comFilterPara1)))
            && (((sint32)(newValue)) >= ((sint32)(filterPtr->comFilterPara2))) )
            {
                ret = TRUE;
            }
            break;

        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSIGNAL_TYPE_UINT16:
        case COM_TXSIGNAL_TYPE_UINT32:
            if( ((newValue) <= (filterPtr->comFilterPara1))
            && ((newValue) >= (filterPtr->comFilterPara2)) )
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate NewIsOutside((min > new_value)
 *                                            OR (new_value > max)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFNewIsOutside(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: (min > new_value) OR (new_value > max) */
    boolean ret = FALSE;
    P2CONST(Com_FilterType, AUTOMATIC, COM_CONST)
    filterPtr = &(Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)]);

    /* calculate filter, if signal type is sint, need extend to sint32, else extend to uint32 */
    switch(Com_GetFlagState(COM_CFG_GWDESTDESC_FLAG(signalId), COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_SINT32:
            if((((sint32)(newValue)) >
                ((sint32)(filterPtr->comFilterPara1)))
                || (((sint32)(newValue)) <
                    ((sint32)(filterPtr->comFilterPara2))))
            {
                ret = TRUE;
            }
            break;

        case COM_TXSIGNAL_TYPE_UINT8:
        case COM_TXSIGNAL_TYPE_UINT16:
        case COM_TXSIGNAL_TYPE_UINT32:
            if(((newValue) >
                (filterPtr->comFilterPara1))
                || ((newValue) <
                    (filterPtr->comFilterPara2)))
            {
                ret = TRUE;
            }
            break;

        default:
            break;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate OneEveryN(occurrence % period == offset).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripFOneEveryN(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter: OCCURRENCE == OFFSET */
    boolean ret = FALSE;
    P2VAR(Com_DestDescripFOccureRTType, AUTOMATIC, COM_VAR)
    destDescRtOccCntrPtr = &(Com_DestDescRTimeOccurenceCntr[COM_CFG_GWDESTDESC_FOCCURENCEINDEX(signalId)]);

    /* FILTER shall be set true when OCCURRENCE == OFFSET */
    if((Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1)
        == (*destDescRtOccCntrPtr))
    {
        ret = TRUE;
    }

    /* OCCURRENCE shall be incremented after filter processing */
    (*destDescRtOccCntrPtr)++;

    /* When OCCURRENCE == PERIOD, OCCURRENCE shall be set to zero */
    if((Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara2)
        == (*destDescRtOccCntrPtr))
    {
        (*destDescRtOccCntrPtr) = 0u;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate boolean filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripBoolFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1)
        != (Com_SignalBoolRuntimeBuff[COM_CFG_GWDESTDESC_VALUEINDEX(signalId)]
             & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint8 or sint8 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescrip8BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1)
        != (Com_Signal8BitRuntimeBuff[COM_CFG_GWDESTDESC_VALUEINDEX(signalId)]
             & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint16 or sint16 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescrip16BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1)
        != (Com_Signal16BitRuntimeBuff[COM_CFG_GWDESTDESC_VALUEINDEX(signalId)]
             & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate uint32 or sint32 filter of MaskedNewDiffersMaskedOld
 *                     ((new_value&mask) != (old_value&mask)).
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal.
 * Param-Name[in]      newValue: Destination Description value.
 *                     destDescriptionId: Destination Description Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Filter is passed or not.
 * PreCondition        None
 * CallByAPI           By TMC calculate.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_DestDescrip32BitFMaskNewDifMaskOld
(uint32 newValue, Com_SignalIdType signalId)
{
    /* filter:  (new_value&mask) != (old_value&mask)*/
    boolean ret = FALSE;
    if((newValue & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1)
        != (Com_Signal32BitRuntimeBuff[COM_CFG_GWDESTDESC_VALUEINDEX(signalId)]
             & Com_Filter[COM_CFG_GWDESTDESC_FILTERPARAINDEX(signalId)].comFilterPara1))
    {
        ret = TRUE;
    }
    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Calculate Destination Description TMS .
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same group signal.
 * Param-Name[in]      destDescriptionId: Destination Description Id.
 *                     signalValuePtr: Pointer to the Destination Description value.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Tx IPdu TMS is changed or not.
 * PreCondition        None
 * CallByAPI           By Com_UpdateShadowSignal.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* return IPdu TMS changed or not */
STATIC FUNC(boolean, COM_CODE)
Com_DestDescripTMSHandle
(
    Com_SignalIdType destDescriptionId,
    P2CONST(void, AUTOMATIC, COM_APPL_DATA) signalValuePtr
)
{

    boolean ret = FALSE;
    uint32 signalNewValue = 0u;
    P2CONST(Com_GwDestDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    destDescPbPtr = &(COM_PTR_GWDESTDESCPB(destDescriptionId));

    /* get description new value based on signal type, uint8N_Filter is only Always or Never,
     * no matter what value it is.
     */
    switch(Com_GetFlagState(destDescPbPtr->comGwDestFlag, COM_PBTXSIGNALTYPE_MASK))
    {
        case COM_TXSIGNAL_TYPE_BOOLEAN:
            signalNewValue = (uint32)(*((boolean*)signalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT8:
        case COM_TXSIGNAL_TYPE_UINT8:
            signalNewValue = (uint32)(*((uint8*)signalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT16:
        case COM_TXSIGNAL_TYPE_UINT16:
            signalNewValue = (uint32)(*((uint16*)signalValuePtr));
            break;

        case COM_TXSIGNAL_TYPE_SINT32:
        case COM_TXSIGNAL_TYPE_UINT32:
            signalNewValue = (uint32)(*((uint32*)signalValuePtr));
            break;

        default:
            break;
    }

    {
        /* Calculate filter result */
        boolean filterFncRet = 
        Com_FilterFunctionArray[destDescPbPtr->comFilterFuncIndex](signalNewValue, destDescriptionId);
        P2VAR(uint16_least, AUTOMATIC, COM_VAR)
        txIpduRtTmsCntrPtr = &(Com_TxIPduRTimeState[destDescPbPtr->comGwDestIPduRefIndex].txTMSCntr);
        P2VAR(Com_DestDescripLastTMCRTType, AUTOMATIC, COM_VAR)
        destDescRtLastTmcPtr = &(Com_DestDescripRTimeLastTMC[destDescPbPtr->comTMCIndex]);
        
        
        /* Tx Signal TMC TRUE->FALSE */
        if(FALSE == filterFncRet)
        {
           /* tx signal last filter result is TRUE */
           if(TRUE == (*destDescRtLastTmcPtr))
           {
               /* signal TMC TRUE->FALSE, IPdu TMS cntr--, assign signal last TMC, TMC Changed */
               if(0 == (--(*txIpduRtTmsCntrPtr)))
               {   
                   ret = TRUE;
               }
               *destDescRtLastTmcPtr = FALSE;
           }
        }
        else  /* Tx Signal TMC FALSE->TRUE */
        {
           /* tx signal last filter result is FALSE */
           if(FALSE == (*destDescRtLastTmcPtr))
           {
               /* signal TMC FALSE->TRUE, IPdu TMS cntr++, assign signal last TMC, TMC Changed */
               (*txIpduRtTmsCntrPtr)++;
               *destDescRtLastTmcPtr = TRUE;
               ret = TRUE;
           }
        }
    }

    return ret;

}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


#endif    /* (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE) */
/* DL201429 */


/******************************************************************************/
/*
 * Brief               Cancel direct/n times tx if DM timeout.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu.
 * Param-Name[in]      txIPduId: IPdu Id
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_MainFunctionTx.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void , COM_CODE)
Com_TxDMTOutCancelTx(PduIdType txIPduId)
{
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR) 
    txIpduRtStatePtr = &(Com_TxIPduRTimeState[txIPduId]);
    /* if DM timeout, cancel Direct/N Transmit in Direct/N or Mixed TxMode */
    /* TRUE TxMode */
    /* DL201419 */
    #if (STD_ON == COM_FILTER_ENABLE)
    if(txIpduRtStatePtr->txTMSCntr > 0u)
    /* DL201419 */
    #endif    /* STD_ON == COM_FILTER_ENABLE */
    {
        switch(COM_CFG_TXMODE_TRUE(txIPduId))
        {
            case COM_TX_MODE_DIRECT:
            case COM_TX_MODE_MIXED:
                /* Reset N-Times, NPeriod, MDT counter */
                txIpduRtStatePtr->txRmnTimesOfN = 0u;
                txIpduRtStatePtr->txNTimesPDCntr = 0u;
                txIpduRtStatePtr->txMDTCntr = 0u;
                break;

            default:
                break;
        }
    }
    /* FALSE TxMode */
    /* DL201419 */
    #if (STD_ON == COM_FILTER_ENABLE)
    else
    {
        switch(COM_CFG_TXMODE_FALSE(txIPduId))
        {
            case COM_TX_MODE_DIRECT:
            case COM_TX_MODE_MIXED:
                /* Reset N-Times, NPeriod, MDT counter */
                txIpduRtStatePtr->txRmnTimesOfN = 0u;
                txIpduRtStatePtr->txNTimesPDCntr = 0u;
                txIpduRtStatePtr->txMDTCntr = 0u;
                break;

            default:
                break;
        }
    }
    /* DL201419 */
    #endif    /* STD_ON == COM_FILTER_ENABLE */

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Confirmation of the IPdu.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu.
 * Param-Name[in]      comTxPduId: IPdu Id
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_MainFunctionTx & Com_TxConfirmation.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_ConfirmationProcess(const PduIdType comTxPduId)
{
    boolean needAckNotif = FALSE;
    uint16 loopCntr = 0u;

    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRtStatePtr = &(Com_TxIPduRTimeState[comTxPduId]);
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPbPtr = &(COM_PTR_TXIPDUPB(comTxPduId));

    /* Judge needing AckNotification or not */
    if(txIpduRtStatePtr->txRmnTimesOfN > 0u)
    {
        txIpduRtStatePtr->txRmnTimesOfN--;

        /* Reset Tx_IPduMDT */
        txIpduRtStatePtr->txMDTCntr = txIpduPbPtr->comIPduMDT;

        /* if Direct/N Times tx is send N-Times */
        if(0u == txIpduRtStatePtr->txRmnTimesOfN)
        {
            needAckNotif = TRUE;
            /* Reset Tx_IPduDM */
            txIpduRtStatePtr->txDMCntr = 0u;

            /* Reset NPeriod, if Direct/N times send is over earlier */
            /* example, earlier TxConfirmation is back in Direct/N period */
            txIpduRtStatePtr->txNTimesPDCntr = 0u;

            /* this IPdu is Confirmed */
            Com_ClearFlagState(Com_TxIPduRTimeFlag[comTxPduId],COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
        }
    }
    else    /* No direct/N times send out */
    {
        if(((COM_TX_MODE_DIRECT != COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxMode)
            #if (STD_ON == COM_FILTER_ENABLE)
                && (txIpduRtStatePtr->txTMSCntr > 0u))
            || ((txIpduRtStatePtr->txTMSCntr == 0u) && (COM_TX_MODE_DIRECT != COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxMode)
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            ))
        {
            needAckNotif = TRUE;
            /* Reset Tx_IPduDM */
            txIpduRtStatePtr->txDMCntr = 0u;
            /* Reset Tx_IPduMDT */
            txIpduRtStatePtr->txMDTCntr = txIpduPbPtr->comIPduMDT;
            /* this IPdu is Confirmed */
            Com_ClearFlagState(Com_TxIPduRTimeFlag[comTxPduId],COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
        }
    }

    /* Ack Notificaiton if needed */
    if(TRUE == needAckNotif)
    {
        /* DL201425 */
        /* Loop All Tx_Singal to AckNotif */
        for(loopCntr = txIpduPbPtr->comSignalIndexStart;
            loopCntr <= txIpduPbPtr->comSignalIndexStop; loopCntr++)
        {
            /* if cfged TxAckFunc */
            if(NULL_PTR != Com_TxSignalLT[COM_CFG_TXSIGNAL_ID(loopCntr)].comCbkTxAckFunc)
            {
                Com_TxSignalLT[COM_CFG_TXSIGNAL_ID(loopCntr)].comCbkTxAckFunc();
            }
        }
        /* Loop All Tx_SingalGroup to AckNotif */
        for(loopCntr = txIpduPbPtr->comSignalGroupIndexStart;
            loopCntr <= txIpduPbPtr->comSignalGroupIndexStop; loopCntr++)
        {
            /* if cfged TxAckFunc */
            if(NULL_PTR != Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(loopCntr)].comSignalGroupCbkTxAckFnc)
            {
                Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(loopCntr)].comSignalGroupCbkTxAckFnc();
            }
        }
        /* DL201425 */
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Start rx sub IPdu group.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu group.
 * Param-Name[in]      comRxSubIPduGroupId: IPdu group Id
 *                     initialize: Flag to request initialization of the data in
 *                     the data in the I-PDUs of this I-PDU group.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_IpduGroupStart.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RxSubIPduGroupStart
(Com_PduGroupIdType comRxSubIPduGroupId, boolean initialize)
{
    boolean isAlreadyActived = FALSE;
    

    /* Set IpduGroup Active Flag, if IPduGroupId is >31u, should check & set Com_IPduGroupActive_H */
    if(comRxSubIPduGroupId > (uint16)31u)
    {
        /* Not Already Actived */
        if(0u == ((Com_IPduGroupActive[1]) & ((uint32)1u << (comRxSubIPduGroupId - (uint16)32u))))
        {
            Com_IPduGroupActive[1] |= ((uint32)1u << (comRxSubIPduGroupId - (uint16)32u));
        }
        else
        {
            isAlreadyActived = TRUE;
        }
    }
    else    /* should check & clear Com_IPduGroupActive_L */
    {
        /* Not Already Actived */
        if(0u == ((Com_IPduGroupActive[0]) & ((uint32)1u << (comRxSubIPduGroupId))))
        {
            Com_IPduGroupActive[0] |= ((uint32)1u << (comRxSubIPduGroupId));
        }
        else
        {
            isAlreadyActived = TRUE;
        }
    }

    if(FALSE == isAlreadyActived)
    {
        uint16 cirCntr = 0u;
        PduIdType rxIpduId = 0;
        P2CONST(Com_RxIPduPBType, AUTOMATIC, COM_CONST_PBCFG) rxIpduPbPtr = NULL_PTR;

        /* DL201419 */
        #if((STD_ON == COM_UPDATEBIT_ENABLE) || (STD_ON == COM_FILTER_ENABLE))
        uint16 signalLoopCntr = 0u;
        /* DL201419 */
        #endif

        /* DL201425 */
        /* Loop all RxIpdu of this IPduGroup */
        for(cirCntr = COM_CFG_RXIPDU_INDEX_START(comRxSubIPduGroupId);
            cirCntr <= COM_CFG_RXIPDU_INDEX_STOP(comRxSubIPduGroupId); cirCntr++)
        {
            rxIpduId = COM_CFG_RXIPDU_ID(cirCntr);
            rxIpduPbPtr = &(COM_PTR_RXIPDUPB(rxIpduId));
            /* need init timers */
            if(TRUE == initialize)
            {
                /* Reset IPdu_DM */
                Com_RxIPduRTimeDMCntr[rxIpduId] = COM_CFG_RXIPDU_FIRSTDM(rxIpduId);

                /* DL201419,DL201418 */
                #if((STD_ON == COM_UPDATEBIT_ENABLE) || (STD_ON == COM_FILTER_ENABLE))
                /* Reset Signal_DM, & Clear Update-Bit */
                for(signalLoopCntr = rxIpduPbPtr->comSignalIndexStart;
                    signalLoopCntr <= rxIpduPbPtr->comSignalIndexStop;
                    signalLoopCntr++)
                {
                    /* DL201418 */
                    #if(STD_ON == COM_UPDATEBIT_ENABLE)
                    /* if Cfg_DM > 0u & Cfg_Update, reset FirstDM Timer */
                    if((Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalLoopCntr)].comSignalFirstDMTOut > 0u) &&
                        (COM_INDEX_DEFAULT != (COM_CFG_RXSIGNAL_UPDATEBITPOS(COM_CFG_RXSIGNAL_ID(signalLoopCntr)))))
                    {
                        Com_RxUpdateSignalRTimeDMCntr[COM_PTR_RXSIGNALPB(COM_CFG_RXSIGNAL_ID(signalLoopCntr)).comSignalDMIndex]
                        = Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalLoopCntr)].comSignalFirstDMTOut;

                        /* if RxIPdu is Deferred or GWed, there is RxIPduRuntimeBuffer, clear update bit */
                        if(COM_INDEX_DEFAULT != rxIpduPbPtr->comRxIPduBufIndex)
                        {
                            Com_ClrBitFrm8ByteArr(
                                (&(Com_RxIPduRuntimeBuff[rxIpduPbPtr->comRxIPduBufIndex]))
                                ,(COM_CFG_RXSIGNAL_UPDATEBITPOS(COM_CFG_RXSIGNAL_ID(signalLoopCntr))) );
                        }
                    }
                    /* DL201418 */
                    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

                    /* if Cfged filter OneEveryN, Clear Occurence Counter */
                    #if (STD_ON == COM_FILTER_ENABLE)
                    if(COM_RXFILTER_ONEN_FUNCINDEX ==
                        COM_CFG_RXSIGNAL_FILTERFNCINDEX(COM_CFG_RXSIGNAL_ID(signalLoopCntr)))
                    {
                        /* DL201401, DL201402 */
                        Com_RxSignalRTimeOccurenceCntr[Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalLoopCntr)].comFilterOccurceIndex] = 0u;
                        /* DL201401, DL201402 */
                    }
                    #endif    /* STD_ON == COM_FILTER_ENABLE */
                }
                /* DL201419,DL201418 */
                #endif

                /* DL201418 */
                #if(STD_ON == COM_UPDATEBIT_ENABLE)
                /* Reset SignalGroup_DM, & Clear Update-Bit */
                for(signalLoopCntr = rxIpduPbPtr->comSignalGroupIndexStart;
                    signalLoopCntr <= rxIpduPbPtr->comSignalGroupIndexStop;
                    signalLoopCntr++)
                {
                    /* if Cfg_DM > 0u & Cfg_Update, reset FirstDM Timer */
                    if((Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalLoopCntr)].comSignalGroupFirstDMCntr > 0u) &&
                        (COM_INDEX_DEFAULT != (COM_CFG_RXSIGGRP_UPDATEBITPOS(COM_CFG_RXSIGNALGROUP_ID(signalLoopCntr)))))
                    {
                        Com_RxUpdateSigGrpRTimeDMCntr[COM_CFG_RXSIGGRP_DMINDEX(COM_CFG_RXSIGNALGROUP_ID(signalLoopCntr))]
                        = Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalLoopCntr)].comSignalGroupFirstDMCntr;
                    }

                    /* if RxIPdu is Deferred or GWed, there is RxIPduRuntimeBuffer, clear update bit */
                    if(COM_INDEX_DEFAULT != rxIpduPbPtr->comRxIPduBufIndex)
                    {
                        Com_ClrBitFrm8ByteArr(
                            (&(Com_RxIPduRuntimeBuff[rxIpduPbPtr->comRxIPduBufIndex]))
                            ,(COM_CFG_RXSIGGRP_UPDATEBITPOS(COM_CFG_RXSIGNALGROUP_ID(signalLoopCntr))) );
                    }
                }
                /* DL201418 */
                #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

                /* DL201430 */
                /* Clear Source Description updatebit*/
                #if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE))
                for(signalLoopCntr = COM_CFG_RXSIGGWMAP_STARTINDEX(cirCntr);
                    signalLoopCntr <= COM_CFG_RXSIGGWMAP_STOPINDEX(cirCntr); signalLoopCntr++)
                {
                    /* Source is Description */
                    if(COM_GWMAP_DESCRIPTION_MARK <= COM_CFG_SIGGWMAP_SRCID(signalLoopCntr))
                    {
                        if(COM_INDEX_DEFAULT != COM_CFG_GWSRCDESC_UPDATEBITPOS
                                ((COM_CFG_SIGGWMAP_SRCID(signalLoopCntr)) & (~(COM_GWMAP_DESCRIPTION_MARK))))
                        {
                            Com_ClrBitFrm8ByteArr(
                                (&(Com_RxIPduRuntimeBuff[rxIpduPbPtr->comRxIPduBufIndex]))
                                , (COM_CFG_GWSRCDESC_UPDATEBITPOS((COM_CFG_SIGGWMAP_SRCID(signalLoopCntr))
                                                                  & (~(COM_GWMAP_DESCRIPTION_MARK)))) );
                        }
                    }
                }
                #endif    /* ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE)) */
                /* DL201429, DL201430 */
            }

            /* if Cfged filter OneEveryN, Clear Occurence Counter */
            #if (STD_ON == COM_FILTER_ENABLE)
            else    /* FALSE == initialize */
            {
                for(signalLoopCntr = rxIpduPbPtr->comSignalIndexStart;
                    signalLoopCntr <= rxIpduPbPtr->comSignalIndexStop;
                    signalLoopCntr++)
                {
                    if(COM_RXFILTER_ONEN_FUNCINDEX == COM_CFG_RXSIGNAL_FILTERFNCINDEX(COM_CFG_RXSIGNAL_ID(signalLoopCntr)))
                    {
                        /* DL201401, DL201402 */
                        Com_RxSignalRTimeOccurenceCntr[Com_RxSignalLT
                                                       [COM_CFG_RXSIGNAL_ID(signalLoopCntr)].comFilterOccurceIndex] = 0u;
                        /* DL201401, DL201402 */
                    }
                }
            }
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            /* DL201425 */

            /* set Active Flag & Enable Rx IPdu_DM*/
            Com_SetFlagState(Com_RxIPduRTimeFlag[rxIpduId],
                             (COM_RT_RXIPDUFLAG_ACTIVE_MASK | COM_RT_RXIPDUFLAG_ENABLEDM_MASK));
        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Start tx sub IPdu group.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu group.
 * Param-Name[in]      comTxSubIPduGroupId: IPdu group Id
 *                     initialize: Flag to request initialization of the data in
 *                     the data in the I-PDUs of this I-PDU group.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_IpduGroupStart.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxSubIPduGroupStart
(Com_PduGroupIdType comTxSubIPduGroupId, boolean initialize)
{
    boolean isAlreadyActived = FALSE;

    /* DL201419, DL201427 */
    #if((STD_ON == COM_UPDATEBIT_ENABLE) || (STD_ON == COM_FILTER_ENABLE))
    uint16 signalCntr = 0u;
    /* DL201419, DL201427 */
    #endif

    /* DL201427 */
    #if(STD_ON == COM_FILTER_ENABLE)
    uint16 groupsSignalCntr = 0u;
    #endif
    /* DL201427 */

    /* Set IpduGroup Active Flag, if IPduGroupId is >31u, should check & set Com_IPduGroupActive_H  */
    if(comTxSubIPduGroupId > (uint16)31u)
    {
        /* Not Already Actived */
        if(0u == ((Com_IPduGroupActive[1]) & ((uint32)1u << (comTxSubIPduGroupId - (uint16)32u))))
        {
            Com_IPduGroupActive[1] |= ((uint32)1u << (comTxSubIPduGroupId - (uint16)32u));
        }
        else
        {
            isAlreadyActived = TRUE;
        }
    }
    else    /* should check & clear Com_IPduGroupActive_L */
    {
        /* Not Already Actived */
        if(0u == ((Com_IPduGroupActive[0]) & ((uint32)1u << (comTxSubIPduGroupId))))
        {
            Com_IPduGroupActive[0] |= ((uint32)1u << (comTxSubIPduGroupId));
        }
        else
        {
            isAlreadyActived = TRUE;
        }
    }

    /* DL201425 */
    if(FALSE == isAlreadyActived)
    {
        uint16 cirCntr = 0u;
        P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR) txIpduRtStatePtr = NULL_PTR;
        P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG) txIpduPbPtr = NULL_PTR;
        P2CONST(Com_TxModeType, AUTOMATIC, COM_CONST_PBCFG) txModePtr = NULL_PTR;
        /*uint16 iPduIndex = COM_CFG_TXIPDU_INDEX_START(comTxSubIPduGroupId);*/

        /* Loop all TxIpdu of this IPduGroup */
        for(cirCntr = COM_CFG_TXIPDU_INDEX_START(comTxSubIPduGroupId);
            cirCntr <= COM_CFG_TXIPDU_INDEX_STOP(comTxSubIPduGroupId); cirCntr++)
        {
            txIpduRtStatePtr = &(Com_TxIPduRTimeState[COM_CFG_TXIPDU_ID(cirCntr)]);
            txIpduPbPtr = (Com_TxIPduPBType *)(&(COM_PTR_TXIPDUPB(COM_CFG_TXIPDU_ID(cirCntr))));
            /* set Active Flag */
            Com_SetFlagState(Com_TxIPduRTimeFlag[COM_CFG_TXIPDU_ID(cirCntr)],COM_RT_TXIPDUFLAG_ACTIVE_MASK);

            /* Reset Timer & UpdateBit based on initialize & txMode */
            if(TRUE == initialize)
            {
                /* Reset IPdu_DM */
                txIpduRtStatePtr->txDMCntr = 0u;

                /* Reset Other_Timer, TxMode is True */
                /* DL201419 */
                #if(STD_ON == COM_FILTER_ENABLE)
                if(txIpduRtStatePtr->txTMSCntr > 0u)
                #endif
                {
                    txModePtr = (Com_TxModeType *)(&(COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex)));
                /* DL201419 */
                    switch(txModePtr->comTxMode)
                    {
                        /* DL201405 */
                        case COM_TX_MODE_DIRECT:
                            txIpduRtStatePtr->txMDTCntr = 0u;
                            break;

                        case COM_TX_MODE_PERIODIC:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimeOffset;
                            break;

                        case COM_TX_MODE_MIXED:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimeOffset;
                            txIpduRtStatePtr->txMDTCntr = 0u;
                            break;

                        default:
                            break;
                        /* DL201405 */
                    }
                /* DL201419 */
                }
                #if(STD_ON == COM_FILTER_ENABLE)
                /* TxMode is False */
                else
                {
                    txModePtr = (Com_TxModeType *)(&(COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex)));
                    switch(txModePtr->comTxMode)
                    {
                        /* DL201405 */
                        case COM_TX_MODE_DIRECT:
                            txIpduRtStatePtr->txMDTCntr = 0u;
                            break;

                        case COM_TX_MODE_PERIODIC:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimeOffset;
                            break;

                        case COM_TX_MODE_MIXED:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimeOffset;
                            txIpduRtStatePtr->txMDTCntr = 0u;
                            break;

                        default:
                            break;
                        /* DL201405 */
                    }
                }
                /* DL201419 */
                #endif

                /* Clear UpdateBit of Signal, Reset OccurenceCntr if Cfged filter is OneEveryN */
                /* DL201419, DL201418 */
                #if((STD_ON == COM_UPDATEBIT_ENABLE) || (STD_ON == COM_FILTER_ENABLE))
                for(signalCntr = txIpduPbPtr->comSignalIndexStart;
                    signalCntr <= txIpduPbPtr->comSignalIndexStop; signalCntr++)
                {
                    /* DL201418 */
                    #if(STD_ON == COM_UPDATEBIT_ENABLE)
                    if(COM_INDEX_DEFAULT != COM_PTR_TXSIGNALPB(COM_CFG_TXSIGNAL_ID(signalCntr)).comSignalUpdateBitPos)
                    {
                        Com_ClrBitFrm8ByteArr(
                            (&(Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex]))
                            , (COM_PTR_TXSIGNALPB(COM_CFG_TXSIGNAL_ID(signalCntr)).comSignalUpdateBitPos) );
                    }
                    /* DL201418 */
                    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

                    #if(STD_ON == COM_FILTER_ENABLE)
                    if(COM_TXSIGFILTER_ONEN_FUNCINDEX == COM_PTR_TXSIGNALPB(COM_CFG_TXSIGNAL_ID(signalCntr)).comFilterFuncIndex)
                    {
                        /* DL201401, DL201402 */
                        Com_TxSignalRTimeOccurenceCntr[Com_TxSignalLT
                                                       [COM_CFG_TXSIGNAL_ID(signalCntr)].comFilterOccurceIndex] = 0u;
                        /* DL201401, DL201402 */
                    }
                    #endif    /* STD_ON == COM_FILTER_ENABLE */
                }
                /* DL201419, DL201418 */
                #endif

                /* Clear UpdateBit of SignalGroup, Reset OccurenceCntr if Cfged filter is OneEveryN */
                /* DL201419, DL201418 */
                #if((STD_ON == COM_UPDATEBIT_ENABLE) || (STD_ON == COM_FILTER_ENABLE))
                for(signalCntr = txIpduPbPtr->comSignalGroupIndexStart;
                    signalCntr <= txIpduPbPtr->comSignalGroupIndexStop; signalCntr++)
                {
                    /* DL201418 */
                    #if(STD_ON == COM_UPDATEBIT_ENABLE)
                    if(COM_INDEX_DEFAULT != COM_PTR_TXSIGGRPPB(COM_CFG_TXSIGNALGROUP_ID(signalCntr)).comUpdateBitPos)
                    {
                        Com_ClrBitFrm8ByteArr(
                            (&(Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex]))
                            , (COM_PTR_TXSIGGRPPB(COM_CFG_TXSIGNALGROUP_ID(signalCntr)).comUpdateBitPos) );
                    }
                    /* DL201418 */
                    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

                    /* Reset Occurence is 0 if Cfged OneEveryN */
                    #if(STD_ON == COM_FILTER_ENABLE)
                    {
                        for(groupsSignalCntr = Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(signalCntr)].comTxGroupSignalIndexStart;
                            groupsSignalCntr <= Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(signalCntr)].comTxGroupSignalIndexStop;
                            groupsSignalCntr++)
                        {
                            if(COM_TXGSFILTER_ONEN_FUNCINDEX == COM_PTR_TXGRPSIGPB(groupsSignalCntr).comFilterFuncIndex)
                            {
                                /* DL201401 */
                                Com_TxGrpSigRTimeOccurenceCntr[Com_TxGroupSignalLT[groupsSignalCntr].comFilterOccurceIndex] = 0u;
                                /* DL201401 */
                            }
                        }
                    }
                    #endif    /* STD_ON == COM_FILTER_ENABLE */
                }
                /* DL201419, DL201418 */
                #endif

                /* DL201429, DL201430 */
                /* Reset Destiantion Description Occurence is 0 if Cfged OneEveryN, & clear update bit */
                #if (((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))    \
                   || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_UPDATEBIT_ENABLE)))
                for(signalCntr = COM_PTR_TXIPDUPB(cirCntr).comDestDescripStart;
                    signalCntr <= COM_PTR_TXIPDUPB(cirCntr).comDestDescripStop; signalCntr++)
                {
                    #if(STD_ON == COM_UPDATEBIT_ENABLE)
                    if(COM_INDEX_DEFAULT != COM_PTR_GWDESTDESCPB(signalCntr).comGwDestUpdateBitPos)
                    {
                        Com_ClrBitFrm8ByteArr(
                            (&(Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex]))
                            , (COM_PTR_GWDESTDESCPB(signalCntr).comGwDestUpdateBitPos) );
                    }
                    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

                    #if(STD_ON == COM_FILTER_ENABLE)
                    if(COM_DESTDESCFILTER_ONEN_FUNCINDEX == COM_PTR_GWDESTDESCPB(signalCntr).comFilterFuncIndex)
                    {
                        Com_DestDescRTimeOccurenceCntr[COM_PTR_GWDESTDESCPB(signalCntr).comFilterOccurceIndex] = 0u;
                    }
                    #endif    /* STD_ON == COM_FILTER */
                }
                /* ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
                 * || ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE)) */
                #endif
                /* DL201429, DL201430 */
            }
            else    /* FALSE == initialize */
            {
                /* Reset Other_Timer, TxMode is TRUE */
                /* DL201419 */
                #if(STD_ON == COM_FILTER_ENABLE)
                if(txIpduRtStatePtr->txTMSCntr > 0u)
                #endif   /* STD_ON == COM_FILTER_ENABLE */
                {
                    txModePtr = (Com_TxModeType *)(&(COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex)));
                /* DL201419 */
                    switch(txModePtr->comTxMode)
                    {
                        case COM_TX_MODE_PERIODIC:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimePeriod;
                            break;

                        case COM_TX_MODE_MIXED:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimePeriod;
                            break;

                        default:
                            break;
                    }
                /* DL201419 */
                }
                #if(STD_ON == COM_FILTER_ENABLE)
                else    /*  TxMode is FALSE */
                {
                    txModePtr = (Com_TxModeType *)(&(COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex)));
                    switch(txModePtr->comTxMode)
                    {
                        case COM_TX_MODE_PERIODIC:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimePeriod;
                            break;

                        case COM_TX_MODE_MIXED:
                            txIpduRtStatePtr->txPDCntr = txModePtr->comTxModeTimePeriod;
                            break;

                        default:
                            break;
                    }
                }
                /* DL201419 */
                #endif    /* STD_ON == COM_FILTER_ENABLE */

                /* Reset Occurence is 0 if Cfged OneEveryN */
                #if(STD_ON == COM_FILTER_ENABLE)
                {
                    /* txsignal */
                    for(signalCntr = txIpduPbPtr->comSignalIndexStart;
                        signalCntr <= txIpduPbPtr->comSignalIndexStop; signalCntr++)
                    {
                        if(COM_TXSIGFILTER_ONEN_FUNCINDEX == COM_PTR_TXSIGNALPB(COM_CFG_TXSIGNAL_ID(signalCntr)).comFilterFuncIndex)
                        {
                            /* DL201401, DL201402 */
                            Com_TxSignalRTimeOccurenceCntr[Com_TxSignalLT[COM_CFG_TXSIGNAL_ID
                                                                          (signalCntr)].comFilterOccurceIndex] = 0u;
                            /* DL201401, DL201402 */
                        }
                    }

                    /* txgroupsignal */
                    for(signalCntr = txIpduPbPtr->comSignalGroupIndexStart;
                        signalCntr <= txIpduPbPtr->comSignalGroupIndexStop; signalCntr++)
                    {
                        /* Reset Occurence is 0 if Cfged OneEveryN */
                        for(groupsSignalCntr = Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(signalCntr)].comTxGroupSignalIndexStart;
                            groupsSignalCntr <= Com_TxSignalGroupLT[COM_CFG_TXSIGNALGROUP_ID(signalCntr)].comTxGroupSignalIndexStop;
                            groupsSignalCntr++)
                        {
                            if(COM_TXGSFILTER_ONEN_FUNCINDEX == COM_PTR_TXGRPSIGPB(groupsSignalCntr).comFilterFuncIndex)
                            {
                                /* DL201401, DL201402 */
                                Com_TxGrpSigRTimeOccurenceCntr[Com_TxGroupSignalLT[groupsSignalCntr].comFilterOccurceIndex] = 0u;
                                /* DL201401, DL201402 */
                            }
                        }
                    }
                }
                #endif    /* STD_ON == COM_FILTER_ENABLE */

                /* DL201429 */
                /* Reset Destiantion Description Occurence is 0 if Cfged OneEveryN */
                #if ((STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE))
                for(signalCntr = COM_PTR_TXIPDUPB(cirCntr).comDestDescripStart;
                    signalCntr <= COM_PTR_TXIPDUPB(cirCntr).comDestDescripStop; signalCntr++)
                {
                    if(COM_DESTDESCFILTER_ONEN_FUNCINDEX == COM_PTR_GWDESTDESCPB(signalCntr).comFilterFuncIndex)
                    {
                        Com_DestDescRTimeOccurenceCntr[COM_PTR_GWDESTDESCPB(signalCntr).comFilterOccurceIndex] = 0u;
                    }
                }
                #endif    /* (STD_ON == COM_GATEWAY_ENABLE) && (STD_ON == COM_FILTER_ENABLE) */
                /* DL201429 */
            }
        }
    }
    /* DL201425 */

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Stop rx sub IPdu group.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu group.
 * Param-Name[in]      comRxSubIPduGroupId: IPdu group Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_IpduGroupStop.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RxSubIPduGroupStop(Com_PduGroupIdType comRxSubIPduGroupId)
{
    boolean isAlreadyStopped = FALSE;

    /* DL201427 */
    #if(STD_ON == COM_UPDATEBIT_ENABLE)
    uint16 signalWithDMLoop = 0u;
    #endif

    /* This IPduGroup is Already Stopped or not, if IPduGroupId is >31u, should check & clear Com_IPduGroupActive_H */
    if(comRxSubIPduGroupId > (uint16)31u)
    {
        /* Not Already Stopped */
        if(((Com_IPduGroupActive[1]) & ((uint32)1u << (comRxSubIPduGroupId - (uint16)32u))) > 0u)
        {
            Com_IPduGroupActive[1] &= (~((uint32)1u << (comRxSubIPduGroupId - (uint16)32u)));
        }
        else
        {
            isAlreadyStopped = TRUE;
        }
    }
    else    /* should check & clear Com_IPduGroupActive_L */
    {
        /* Not Already Stopped */
        if(((Com_IPduGroupActive[0]) & ((uint32)1u << (comRxSubIPduGroupId)))> 0u)
        {
            Com_IPduGroupActive[0] &= (~((uint32)1u << (comRxSubIPduGroupId)));
        }
        else
        {
            isAlreadyStopped = TRUE;
        }
    }


    /* Stop this Group */
    if(FALSE == isAlreadyStopped)
    {
        uint16 cirCntr = 0u;
        PduIdType rxIpduId = 0;
        P2CONST(Com_RxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
        rxIpduPbPtr = &(COM_PTR_RXIPDUPB(rxIpduId));
/*        uint16 iPduIndex = COM_CFG_RXIPDU_INDEX_START(comRxSubIPduGroupId);*/

        /* DL201425 */
        /* Loop all RxIPdu in this Group */
        for(cirCntr = COM_CFG_RXIPDU_INDEX_START(comRxSubIPduGroupId);
            cirCntr <= COM_CFG_RXIPDU_INDEX_STOP(comRxSubIPduGroupId); cirCntr++)
        {
            rxIpduId = COM_CFG_RXIPDU_ID(cirCntr);

            /* check there is another IPduGroup which this Ipdu belonged is Active */
            if((0u == (Com_IPduGroupActive[1] & (rxIpduPbPtr->comIPduGroupMaskH)))
                && (0u == (Com_IPduGroupActive[0] & (rxIpduPbPtr->comIPduGroupMaskL))))
            {
                /* Stop this Rx_IPdu */
                Com_ClearFlagState(Com_RxIPduRTimeFlag[rxIpduId],COM_RT_RXIPDUFLAG_ACTIVE_MASK);

                /* Disable RxDM */
                Com_ClearFlagState(Com_RxIPduRTimeFlag[rxIpduId],COM_RT_RXIPDUFLAG_ENABLEDM_MASK);

                /* DL201423, DL201426 */
                /* Set Ipdu DM to 0 */
                Com_RxIPduRTimeDMCntr[rxIpduId] = 0u;

                /* Set UpdateBit Signals & SignalGroups DM to 0 */
                #if(STD_ON == COM_UPDATEBIT_ENABLE)
                {
                    /* DL201425 */
                    /* Reset Signal_DM to 0 */
                    for(signalWithDMLoop = rxIpduPbPtr->comSignalIndexStart;
                        signalWithDMLoop <= rxIpduPbPtr->comSignalIndexStop;
                        signalWithDMLoop++)
                    {
                        /* if Cfg_DM > 0u & Cfg_Update, reset FirstDM Timer */
                        if((Com_RxSignalLT[signalWithDMLoop].comSignalDMTOut > 0u) &&
                            (COM_INDEX_DEFAULT != (COM_CFG_RXSIGNAL_UPDATEBITPOS(COM_CFG_RXSIGNAL_ID(signalWithDMLoop)))))
                        {
                            Com_RxUpdateSignalRTimeDMCntr[COM_CFG_RXSIGNAL_DMINDEX
                                                          (COM_CFG_RXSIGNAL_ID(signalWithDMLoop))] = 0u;
                        }
                    }

                    /* Reset SignalGroup_DM to 0 */
                    for(signalWithDMLoop = rxIpduPbPtr->comSignalGroupIndexStart;
                        signalWithDMLoop <= rxIpduPbPtr->comSignalGroupIndexStop;
                        signalWithDMLoop++)
                    {
                        /* if Cfg_DM > 0u & Cfg_Update, set DM Timer to 0 */
                        if((Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalWithDMLoop)].comSignalGroupDMCntr > 0u) &&
                            (COM_INDEX_DEFAULT != (COM_CFG_RXSIGGRP_UPDATEBITPOS(COM_CFG_RXSIGNALGROUP_ID(signalWithDMLoop)))))
                        {
                            Com_RxUpdateSigGrpRTimeDMCntr[COM_CFG_RXSIGGRP_DMINDEX
                                                          (COM_CFG_RXSIGNALGROUP_ID(signalWithDMLoop))] = 0u;
                        }
                    }
                    /* DL201425 */
                }
                #endif   /* STD_ON == COM_UPDATEBIT_ENABLE */
                /* DL201423 */
            }
        }
        /* DL201425 */
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Stop tx sub IPdu group.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu group.
 * Param-Name[in]      comTxSubIPduGroupId: IPdu group Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_IpduGroupStop.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_TxSubIPduGroupStop(Com_PduGroupIdType comTxSubIPduGroupId)
{
    boolean isAlreadyStopped = FALSE;

    /* This IPduGroup is Already Stopped or not, if IPduGroupId is >31u, should check & clear Com_IPduGroupActive_H */
    if(comTxSubIPduGroupId > (uint16)31u)
    {
        /* Not Already Stopped */
        if(((Com_IPduGroupActive[1]) & ((uint32)1u << (comTxSubIPduGroupId - (uint16)32u))) > 0u)
        {
            Com_IPduGroupActive[1] &= (~((uint32)1u << (comTxSubIPduGroupId - (uint16)32u)));
        }
        else
        {
            isAlreadyStopped = TRUE;
        }
    }
    else    /* should check & clear Com_IPduGroupActive_L */
    {
        /* Not Already Stopped */
        if(((Com_IPduGroupActive[0]) & ((uint32)1u << (comTxSubIPduGroupId ))) > 0u)
        {
            Com_IPduGroupActive[0] &= (~((uint32)1u << (comTxSubIPduGroupId)));
        }
        else
        {
            isAlreadyStopped = TRUE;
        }
    }


    /* Stop this Group */
    if(FALSE == isAlreadyStopped)
    {
        boolean needConfirm = FALSE;
        uint16 cirCntr = 0u;
        PduIdType ipduId = 0;
        P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
        txIpduPBPtr = NULL_PTR;
        P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR) 
        txIpduRtStatPtr = NULL_PTR;	

        /* DL201425 */
        /* Loop all TxIPdu of this Group */
        for(cirCntr = COM_PTR_IPDUGROUPPB(comTxSubIPduGroupId).comIPduOrGroupStart;
            cirCntr <= COM_PTR_IPDUGROUPPB(comTxSubIPduGroupId).comIPduOrGroupStop; cirCntr++)
        {
            txIpduPBPtr = &(COM_PTR_TXIPDUPB(ipduId));
            txIpduRtStatPtr = &(Com_TxIPduRTimeState[ipduId]);	
            ipduId = COM_CFG_TXIPDU_ID(cirCntr);

            /* check there is another IPduGroup which this Ipdu belonged is Active */
            if((0u == (Com_IPduGroupActive[1] & (txIpduPBPtr->comIPduGroupMaskH)))
                && (0u == (Com_IPduGroupActive[0] & (txIpduPBPtr->comIPduGroupMaskL))))
            {
                /* Stop this Tx_IPdu */
                Com_ClearFlagState(Com_TxIPduRTimeFlag[ipduId],COM_RT_TXIPDUFLAG_ACTIVE_MASK);

                /* Disable Tx on Period, include Dirct/N(N>1), Period, Mix */
                txIpduRtStatPtr->txNTimesPDCntr = 0u;
                txIpduRtStatPtr->txPDCntr = 0u;
                txIpduRtStatPtr->txRmnTimesOfN = 0u;

                /* if not Confirmed, DM Timeout Notification */
                /* Need Confirmation */
                /* DL201419 */
                #if(STD_ON == COM_FILTER_ENABLE)
                if(txIpduRtStatPtr->txTMSCntr > 0u)
                {
                /* DL201419 */
                #endif
                    if((COM_TX_MODE_DIRECT == COM_PTR_TXMODE(txIpduPBPtr->comTxModeTrueIndex).comTxMode)
                        && (0u == COM_PTR_TXMODE(txIpduPBPtr->comTxModeTrueIndex).comTxModeNumOfRepeat))
                    {
                        needConfirm = FALSE;
                    }
                    else
                    {
                        needConfirm = TRUE;
                    }
                /* DL201419 */
                #if(STD_ON == COM_FILTER_ENABLE)
                }
                else
                {
                    /* DL201440 */
                    if((COM_TX_MODE_DIRECT == COM_PTR_TXMODE(txIpduPBPtr->comTxModeFalseIndex).comTxMode)
                        && (0u == COM_PTR_TXMODE(txIpduPBPtr->comTxModeFalseIndex).comTxModeNumOfRepeat))
                    /* DL201440 */
                    {
                        needConfirm = FALSE;
                    }
                    else
                    {
                        needConfirm = TRUE;
                    }
                }
                /* DL201419 */
                #endif

                if(TRUE == needConfirm)
                {
                    /* Need Confirm but not Confirmed */
                    if(Com_GetFlagState(Com_TxIPduRTimeFlag[ipduId],COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK) > 0u)
                    {
                        /* DL201403 */
                        Com_TxErrorNotifMF(ipduId)
                        /* DL201403 */

                        /* Clear this IPdu is not Confirmed Flag */
                        Com_ClearFlagState(Com_TxIPduRTimeFlag[ipduId],COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                    }
                }

                /* Disable IPdu_DM */
                txIpduRtStatPtr->txDMCntr = 0u;
            }
        }
        /* DL201425 */
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Enable rx DM of sub rx IPdu group.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu group.
 * Param-Name[in]      comRxSubIPduGroupId: IPdu group Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_EnableReceptionDM.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_EnableRxSubIPduGroupDM(Com_PduGroupIdType comRxSubIPduGroupId)
{
    uint16 cirCntr = 0u;
    /* DL201418 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    uint16 signalCirCntr = 0u;
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
    PduIdType rxIpduId = 0;

    /* DL201425 */
    /* Loop all RxIPdu of this Group */
    for(cirCntr = COM_CFG_RXIPDU_INDEX_START(comRxSubIPduGroupId);
        cirCntr <= COM_CFG_RXIPDU_INDEX_STOP(comRxSubIPduGroupId); cirCntr++)
    {
        rxIpduId = COM_CFG_RXIPDU_ID(cirCntr);
        /* Only Enable DM of which Rx DM is disabled before */
        if(0u == Com_GetFlagState(Com_RxIPduRTimeFlag[rxIpduId],COM_RT_RXIPDUFLAG_ENABLEDM_MASK))
        {
            /* Reset IPdu DM */
            Com_RxIPduRTimeDMCntr[rxIpduId] = COM_PTR_RXIPDUPB(rxIpduId).comIPduFirstDM;

            /* Reset Update_Signal DM */
            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            for(signalCirCntr = COM_CFG_RXSIGNAL_INDEX_START(rxIpduId);
                signalCirCntr <= COM_CFG_RXSIGNAL_INDEX_STOP(rxIpduId);
                signalCirCntr++)
            {
                /* if CFG_DM & CFG_Update */
                if((0u != Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalCirCntr)].comSignalFirstDMTOut) &&
                    (COM_INDEX_DEFAULT != COM_CFG_RXSIGNAL_UPDATEBITPOS(COM_CFG_RXSIGNAL_ID(signalCirCntr))))
                {
                    Com_RxUpdateSignalRTimeDMCntr[COM_CFG_RXSIGNAL_DMINDEX(COM_CFG_RXSIGNAL_ID(signalCirCntr))]
                        = Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalCirCntr)].comSignalFirstDMTOut;
                }
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            /* Reset Update_SignalGroup DM */
            for(signalCirCntr = COM_CFG_RXSIGNALGROUP_INDEX_START(rxIpduId);
                signalCirCntr <= COM_CFG_RXSIGNALGROUP_INDEX_STOP(rxIpduId);
                signalCirCntr++)
            {
                /* if CFG_DM & CFG_Update */
                if((0u != Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalCirCntr)].comSignalGroupFirstDMCntr) &&
                    (COM_INDEX_DEFAULT != COM_CFG_RXSIGGRP_UPDATEBITPOS(COM_CFG_RXSIGNALGROUP_ID(signalCirCntr))))
                {
                    Com_RxUpdateSigGrpRTimeDMCntr[COM_CFG_RXSIGGRP_DMINDEX(COM_CFG_RXSIGNALGROUP_ID(signalCirCntr))]
                        = Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalCirCntr)].comSignalGroupFirstDMCntr;
                }
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

            /* Set IPduEnable DM Flag */
            Com_SetFlagState(Com_RxIPduRTimeFlag[rxIpduId],COM_RT_RXIPDUFLAG_ENABLEDM_MASK);
        }
    }
    /* DL201425 */

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               Disable rx DM of sub rx IPdu group.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu group.
 * Param-Name[in]      comRxSubIPduGroupId: IPdu group Id.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           By Com_DisableReceptionDM.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_DisableRxSubIPduGroupDM(Com_PduGroupIdType comRxSubIPduGroupId)
{
    uint16 cirCntr = 0u;
    /* DL201418 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    uint16 signalCirCntr = 0u;
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
    PduIdType rxIpduId = 0;

    /* DL201425 */
    /* Loop all RxIPdu of this Group */
    for(cirCntr = COM_CFG_RXIPDU_INDEX_START(comRxSubIPduGroupId);
        cirCntr <= COM_CFG_RXIPDU_INDEX_STOP(comRxSubIPduGroupId); cirCntr++)
    {
        rxIpduId = COM_CFG_RXIPDU_ID(cirCntr);
        /* Only Disable DM of which Rx DM is enabled before */
        if((Com_GetFlagState(Com_RxIPduRTimeFlag[rxIpduId],COM_RT_RXIPDUFLAG_ENABLEDM_MASK)) > 0u)
        {
            /* Set IPduEnable DM Flag */
            Com_ClearFlagState(Com_RxIPduRTimeFlag[rxIpduId],COM_RT_RXIPDUFLAG_ENABLEDM_MASK);

            /* Reset IPdu DM */
            Com_RxIPduRTimeDMCntr[rxIpduId] = 0u;

            /* Reset Update_Signal DM */
            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            for(signalCirCntr = COM_CFG_RXSIGNAL_INDEX_START(rxIpduId);
                signalCirCntr <= COM_CFG_RXSIGNAL_INDEX_STOP(rxIpduId);
                signalCirCntr++)
            {
                /* if CFG_DM & CFG_Update */
                if((0u != Com_RxSignalLT[COM_CFG_RXSIGNAL_ID(signalCirCntr)].comSignalDMTOut) &&
                    (COM_INDEX_DEFAULT != COM_CFG_RXSIGNAL_UPDATEBITPOS(COM_CFG_RXSIGNAL_ID(signalCirCntr))))
                {
                    Com_RxUpdateSignalRTimeDMCntr[COM_CFG_RXSIGNAL_DMINDEX(COM_CFG_RXSIGNAL_ID(signalCirCntr))] = 0u;
                }
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            /* Reset Update_SignalGroup DM */
            for(signalCirCntr = COM_CFG_RXSIGNALGROUP_INDEX_START(rxIpduId);
                signalCirCntr <= COM_CFG_RXSIGNALGROUP_INDEX_STOP(rxIpduId);
                signalCirCntr++)
            {
                /* if CFG_DM & CFG_Update */
                if((0u != Com_RxSignalGroupLT[COM_CFG_RXSIGNALGROUP_ID(signalCirCntr)].comSignalGroupDMCntr) &&
                    (COM_INDEX_DEFAULT != COM_CFG_RXSIGGRP_UPDATEBITPOS(COM_CFG_RXSIGNALGROUP_ID(signalCirCntr))))
                {
                    Com_RxUpdateSigGrpRTimeDMCntr[COM_CFG_RXSIGGRP_DMINDEX(COM_CFG_RXSIGNALGROUP_ID(signalCirCntr))] = 0u;
                }
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
        }
    }
    /* DL201425 */

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               MainFunctionTx of direct/n txmode.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu.
 * Param-Name[in]      iPduId: IPdu Id.
 *                     mDTRun: MDT is running.
 *                     txMode: Txmode of this IPdu is TRUE or FALSE.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Send IPdu or not.
 * PreCondition        None
 * CallByAPI           By Com_MainFunctionTx.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_MainFuncTxDirect
(PduIdType iPduId, boolean mDTRun, boolean txMode)
{
    boolean ret = FALSE;

    P2VAR(Com_TxIPduFlagRTType, AUTOMATIC, COM_VAR) 
    txIpduRTFlag = &(Com_TxIPduRTimeFlag[iPduId]);
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR) 
    txIpduRtState = &(Com_TxIPduRTimeState[iPduId]);
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPbPtr = &(COM_PTR_TXIPDUPB(iPduId));

    /* Check NPeriod */
    if(txIpduRtState->txNTimesPDCntr > 0u)
    {
        txIpduRtState->txNTimesPDCntr--;
        if(0u == txIpduRtState->txNTimesPDCntr)
        {
            /* if MDT still Running */
            if(TRUE == mDTRun)
            {
                /* Set delay TxFlag */
                Com_SetFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_DELAY_MASK);
            }
            else /* MDT is not Running, would send out */
            {
                ret = TRUE;
            }

            /* Reset N-Period Timer */
            if((txIpduRtState->txRmnTimesOfN > 0u) && (TRUE == txMode))
            {
                txIpduRtState->txNTimesPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxModeRepeatPeriod;
            }
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            if((txIpduRtState->txRmnTimesOfN > 0u) && (FALSE == txMode))
            {
                txIpduRtState->txNTimesPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxModeRepeatPeriod;
            }
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
        }
    }

    /* Check Delay Tx by MainFunction or Send_API */
    if(FALSE == mDTRun)
    {
         /* Delay Tx by MainFunction */
        if(Com_GetFlagState(*txIpduRTFlag,COM_RT_TXIPDUFLAG_DELAY_MASK) > 0u)
        {
            ret = TRUE;

            /* DL201415 */
            Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_DELAY_MASK);
            /* DL201415 */
        }
		
        /* DL201415 */
        Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_DELAY_MASK);
        /* DL201415 */

        /* Delay Tx by Send_API, this is the first send of Direct/N, so should Set N & NPeriod */
        if(Com_GetFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK) > 0u)
        {
            /* Clear First Delay Flag, Clear COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK here to Prevent Callout
             * Function return FALSE. */
            Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);
            /* DL201417 */
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_TMSCHAINMDT);
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            /* DL201417 */

            /* first tx need check callout function */
            if(COM_INDEX_DEFAULT != Com_TxIPduCalloutLT[iPduId])
            {
                ret = IPdu_CalloutFnc[Com_TxIPduCalloutLT[iPduId]](iPduId, &Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex]);
            }
            else
            {
                ret = TRUE;
            }

            /* if send out, need Reset MDT, Reset DM by Config/0 */
            if(TRUE == ret)
            {        
                /* Reset DM(if first send out) */
                /* Set DM, NTimes, Need Confirmation Flag based on TxMode */
                /* DL201419 */
                #if (STD_ON == COM_FILTER_ENABLE)
                if(TRUE == txMode)
                /* DL201419 */
                #endif    /* STD_ON == COM_FILTER_ENABLE */
                {
                    /* DL201407 */
                    txIpduRtState->txRmnTimesOfN = COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxModeNumOfRepeat;
                    txIpduRtState->txNTimesPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxModeRepeatPeriod;
                    /* DL201407 */
    
                    if(0u != COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxModeNumOfRepeat)
                    {
                        txIpduRtState->txDMCntr = txIpduPbPtr->comIPduDM;
    
                        /* DL201406 */
                        /* Set Not Confirmed Flag */
                        Com_SetFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    else
                    {
                        txIpduRtState->txDMCntr = 0u;
    
                        /* DL201406 */
                        /* Clear Not Confirmed Flag */
                        Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                }
                /* DL201419 */
                #if (STD_ON == COM_FILTER_ENABLE)
                else
                {
                    /* DL201407 */
                    txIpduRtState->txRmnTimesOfN = COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxModeNumOfRepeat;
                    txIpduRtState->txNTimesPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxModeRepeatPeriod;
                    /* DL201407 */
    
                    if(0u != COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxModeNumOfRepeat)
                    {
                        txIpduRtState->txDMCntr = txIpduPbPtr->comIPduDM;
    
                        /* DL201406 */
                        /* Set Not Confirmed Flag */
                        Com_SetFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    else
                    {
                        txIpduRtState->txDMCntr = 0u;
    
                        /* DL201406 */
                        /* Clear Not Confirmed Flag */
                        Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
    
                }
                /* DL201419 */
                #endif    /* STD_ON == COM_FILTER_ENABLE */
            }
        }
    }

    if(TRUE == ret)
    {
        /* Reset MDT */
        txIpduRtState->txMDTCntr = txIpduPbPtr->comIPduMDT;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               MainFunctionTx of mixed txmode.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu.
 * Param-Name[in]      iPduId: IPdu Id.
 *                     mDTRun: MDT is running.
 *                     txMode: Txmode of this IPdu is TRUE or FALSE.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Send IPdu or not.
 * PreCondition        None
 * CallByAPI           By Com_MainFunctionTx.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_MainFuncTxMixed
(PduIdType iPduId, boolean mDTRun, boolean txMode)
{
    boolean ret = FALSE;
    boolean sendornot = FALSE;
    boolean needCalloutRet = FALSE;
    boolean firstDelayTx = FALSE;

    P2VAR(Com_TxIPduFlagRTType, AUTOMATIC, COM_VAR) 
    txIpduRTFlagPtr = &(Com_TxIPduRTimeFlag[iPduId]);
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRTStatePtr = &(Com_TxIPduRTimeState[iPduId]);
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPBPtr = &(COM_PTR_TXIPDUPB(iPduId));
    P2CONST(Com_TxModeType, AUTOMATIC, COM_CONST_PBCFG)
    txModePtr = &(COM_PTR_TXMODE(txIpduPBPtr->comTxModeTrueIndex));

    #if (STD_ON == COM_FILTER_ENABLE)
    if(FALSE == txMode)
    {
        txModePtr = &(COM_PTR_TXMODE(txIpduPBPtr->comTxModeFalseIndex));
    }
    #endif

    /* Check Period */
    if(txIpduRTStatePtr->txPDCntr > 0u)
    {
        txIpduRTStatePtr->txPDCntr--;

        if(0u == txIpduRTStatePtr->txPDCntr)
        {
            /* if MDT still Running */
            if(TRUE == mDTRun)
            {
                /* Set delay TxFlag */
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_DELAY_MASK);
            }
            else /* MDT is not Running, would send out */
            {
                needCalloutRet = TRUE;
            }

            txIpduRTStatePtr->txPDCntr = txModePtr->comTxModeTimePeriod;
        }
    }

    /* Check NPeriod */
    if(txIpduRTStatePtr->txNTimesPDCntr > 0u)
    {
        txIpduRTStatePtr->txNTimesPDCntr--;
        if(0u == txIpduRTStatePtr->txNTimesPDCntr)
        {
            /* if MDT still Running */
            if(TRUE == mDTRun)
            {
                /* Set delay TxFlag */
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_DELAY_MASK);
            }
            else /* MDT is not Running, would send out */
            {
                sendornot = TRUE;
            }

            txIpduRTStatePtr->txNTimesPDCntr = txModePtr->comTxModeRepeatPeriod;
        }
    }


    /* DL201407 */
    /* Check Delay Tx, Delayed Send_API or Delayed MainFunction */
    if(FALSE == mDTRun)
    {
        /* MainFunctionTx Delay, this is Period & Direct(N!=0) Component, because Direct(N==0) sent at
         * FirstDelay Flag is TRUE and MDT == 0*/
        if(Com_GetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_DELAY_MASK) > 0u)
        {
            /* Clear Delay Flag */
            Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_DELAY_MASK);

            /* Period Component, because txRmnTimesOfN of Direct(N!=0) would not be 0 at here. */
            if(0u == txIpduRTStatePtr->txRmnTimesOfN)
            {
                needCalloutRet = TRUE;
            }
            else
            {
                sendornot = TRUE;
            }
        }

        /* First Delay, this is the first tx of Period or Direct/N */
        if(Com_GetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK) > 0u)
        {
            /* Clear First send Flag whatever Callout Function Result. */
            Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);

            /* First Send should check callout function whatever period or direct component */
            needCalloutRet = TRUE;

            /* if pass callout, use this flag to show this send is first IPdu of Direct or
             * Periodic component. use this flag aim to prevent IPdu cannot be send because
             * callout is not pass */
            firstDelayTx = TRUE;

            /* DL201417 */
            /* Reset Period do not care about callout return value, because this is the first send */
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            if(Com_GetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_TMSCHAINMDT) > 0u)
            {
                txIpduRTStatePtr->txPDCntr = txModePtr->comTxModeTimePeriod;
                Com_ClearFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_TMSCHAINMDT);
            }
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            /* DL201417 */
        }
    }
    /* DL201407 */


    /* if Need send out, Check IPduCallout Function */
    if((TRUE == needCalloutRet) && (COM_INDEX_DEFAULT != Com_TxIPduCalloutLT[iPduId]))
    {
        sendornot = IPdu_CalloutFnc[Com_TxIPduCalloutLT[iPduId]](iPduId, &Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]);
    }
    else if((TRUE == needCalloutRet) && (COM_INDEX_DEFAULT == Com_TxIPduCalloutLT[iPduId]))
    {
        sendornot = TRUE;
    }
    else{}

    /* if send out, need Reset MDT, Reset DM by Config, Reset Need Confirmation Flag */
    if(TRUE == sendornot)
    {
        /* Reset MDT */
        txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;

        /* This send is not first send IPdu, maybe is period component or Direct(N!=0) */
        if(FALSE == firstDelayTx)
        {
            /* This send is Period component, Reset DM & Need Confirmation */
            if(0u == txIpduRTStatePtr->txRmnTimesOfN)
            {
                /* Reset DM */
                if(0u == txIpduRTStatePtr->txDMCntr)
                {
                    txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                }

                /* DL201406 */
                /* Set Confirmation Flag, waiting Confirmation */
                Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                /* DL201406 */
            }
            else
            {
                /* This send is Direct(N!=0) component, leave DM & Need Confirmation Flag */
            }
        }
        /* This send is first send IPdu, maybe is period component, maybe direct(N==0), maybe direct(N!=0) */
        else
        {
            /* DL201410 */
            /* this first send is period component */
            if(Com_GetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_DELAYPENDTX) > 0u)
            {
                /* Reset DM */
                if(0u == txIpduRTStatePtr->txDMCntr)
                {
                    txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                }

                /* DL201406 */
                /* Set Confirmation Flag, waiting Confirmation */
                Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                /* DL201406 */

                /* Already send this IPdu, clear this flag */
                Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_DELAYPENDTX);
            }
            /* DL201410 */
            else   /* this first send is direct component, should check cfged N */
            {
                /* txMode=TRUE */
                /* DL201419 */
                #if (STD_ON == COM_FILTER_ENABLE)
                if(TRUE == txMode)
                /* DL201419 */
                #endif    /* STD_ON == COM_FILTER_ENABLE */
                {
                    /* Reset N */
                    txIpduRTStatePtr->txRmnTimesOfN = txModePtr->comTxModeNumOfRepeat;

                    /* Reset N-Timer */
                    txIpduRTStatePtr->txNTimesPDCntr = txModePtr->comTxModeRepeatPeriod;

                    if(0u != txModePtr->comTxModeNumOfRepeat)
                    {
                        /* Reset DM */
                        if(0u == txIpduRTStatePtr->txDMCntr)
                        {
                            txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                        }

                        /* DL201406 */
                        /* Set Confirmation Flag, waiting Confirmation */
                        Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    else
                    {
                        /* Reset DM */
                        txIpduRTStatePtr->txDMCntr = 0u;

                        /* DL201406 */
                        /* Clear Confirmation Flag, waiting Confirmation */
                        Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                }
                /* DL201419 */
                #if (STD_ON == COM_FILTER_ENABLE)
                else
                {
                    /* Reset N */
                    txIpduRTStatePtr->txRmnTimesOfN = txModePtr->comTxModeNumOfRepeat;

                    /* Reset N-Timer */
                    txIpduRTStatePtr->txNTimesPDCntr = txModePtr->comTxModeRepeatPeriod;

                    if(0u != txModePtr->comTxModeNumOfRepeat)
                    {
                        /* Reset DM */
                        if(0u == txIpduRTStatePtr->txDMCntr)
                        {
                            txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                        }

                        /* DL201406 */
                        /* Set Confirmation Flag, waiting Confirmation */
                        Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    else
                    {
                        /* Reset DM */
                        txIpduRTStatePtr->txDMCntr = 0u;

                        /* DL201406 */
                        /* Clear Confirmation Flag, waiting Confirmation */
                        Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                }
                /* DL201419 */
                #endif    /* STD_ON == COM_FILTER_ENABLE */
            }
        }

        ret = TRUE;
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/******************************************************************************/
/*
 * Brief               MainFunctionTx of periodic txmode.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same IPdu.
 * Param-Name[in]      iPduId: IPdu Id.
 *                     mDTRun: MDT is running.
 *                     txMode: Txmode of this IPdu is TRUE or FALSE.
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean: Send IPdu or not.
 * PreCondition        None
 * CallByAPI           By Com_MainFunctionTx.
 */
/******************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_MainFuncTxPeriod
(PduIdType iPduId, boolean mDTRun
/* SW201431 */
#if (STD_ON == COM_FILTER_ENABLE)
, boolean txMode
#endif
/* SW201431 */
)
{
    boolean ret = FALSE;
    boolean needChkCallout = FALSE;
  
    P2VAR(Com_TxIPduFlagRTType, AUTOMATIC, COM_VAR)
    txIpduRTFlag = &(Com_TxIPduRTimeFlag[iPduId]);
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRTStatePtr = &(Com_TxIPduRTimeState[iPduId]);
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPbPtr = &(COM_PTR_TXIPDUPB(iPduId));

    /* Check Period */
    if(txIpduRTStatePtr->txPDCntr > 0u)
    {
        txIpduRTStatePtr->txPDCntr--;

        if(0u == txIpduRTStatePtr->txPDCntr)
        {
            needChkCallout = TRUE;

            /* Reset Period Timer */
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            if(TRUE == txMode)
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
            {
                txIpduRTStatePtr->txPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxModeTimePeriod;
            }
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            else
            {
                txIpduRTStatePtr->txPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxModeTimePeriod;
            }
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */
        }
    }

    /* DL201413 */
    /* Check Tx because: 1.TMS Change & MDT is Running when called Send_API; 2. MDT is not running. */
    /*if((Com_GetFlagState(Com_TxIPduRTimeFlag[iPduId], COM_RT_TXIPDUFLAG_TMSCHAINMDT)) && (FALSE == mDTRun))
    {
        Com_ClearFlagState(Com_TxIPduRTimeFlag[iPduId], COM_RT_TXIPDUFLAG_TMSCHAINMDT);
        needChkCallout = TRUE;
    }*/

    /* Check Tx because: 1.TMS Change & MDT is Running when called Send_API; 2. MDT is not running. */
    if((Com_GetFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK) > 0u) && (FALSE == mDTRun))
    {
        Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);
        needChkCallout = TRUE;

        /* DL201417 */
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        Com_ClearFlagState(*txIpduRTFlag, COM_RT_TXIPDUFLAG_TMSCHAINMDT);
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        /* DL201417 */

        /* Set First Period Timer */
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        if(TRUE == txMode)
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
            txIpduRTStatePtr->txPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeTrueIndex).comTxModeTimePeriod;
        }
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        else
        {
            txIpduRTStatePtr->txPDCntr = COM_PTR_TXMODE(txIpduPbPtr->comTxModeFalseIndex).comTxModeTimePeriod;
        }
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
    }
    /* DL201413 */

    /* if Need send out, Check IPduCallout Function */
    if(TRUE == needChkCallout)
    {
        boolean calloutFncRet = TRUE;

        if(COM_INDEX_DEFAULT != Com_TxIPduCalloutLT[iPduId])
        {
            calloutFncRet = IPdu_CalloutFnc[Com_TxIPduCalloutLT[iPduId]]
                                            (iPduId, &Com_TxIPduRuntimeBuff[txIpduPbPtr->comTxIPduBufIndex]);
        }

        /* if send out, need Reset MDT, Reset DM by Config, Reset Need Confirmation Flag */
        if(TRUE == calloutFncRet)
        {
            /* Reset MDT */
            txIpduRTStatePtr->txMDTCntr = txIpduPbPtr->comIPduMDT;

            /* Reset DM */
            if(0u == txIpduRTStatePtr->txDMCntr)
            {
                txIpduRTStatePtr->txDMCntr = txIpduPbPtr->comIPduDM;
            }

            /* DL201406 */
            /* Set Confirmation Flag, waiting Confirmation */
            Com_SetFlagState(*txIpduRTFlag,COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
            /* DL201406 */

            ret = TRUE;
        }
    }

    return ret;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Deal with uint8 signal within Com_SignalRxIndication. 
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, reentrant
 *                     for different signals.
 * Param-Name[in]      pduDataPtr, rxSignalId, updateBitStat
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_RxSignalHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_Rx8NSignalHandle
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) pduDataPtr, 
    Com_SignalIdType rxSignalId
    /* SW201430 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    ,uint8 updateBitStat
    #endif
    /* SW201430 */
)
{
   
    boolean NeedFilter = TRUE; 
    uint16 cntr = 0;

    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(rxSignalId));
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[rxSignalId]);

    /* DL201434 */
    uint8 signalSize = 0u;

    if(rxSignalPbPtr->comSignalLSBPos < rxSignalPbPtr->comSignalMSBPos)
    {
        signalSize = (uint8)((rxSignalPbPtr->comSignalMSBPos - rxSignalPbPtr->comSignalLSBPos) + 1u);
    }
    else
    {
        signalSize = (uint8)((rxSignalPbPtr->comSignalLSBPos - rxSignalPbPtr->comSignalMSBPos) + 1u);
    }
    /* DL201434 */

    /* check if signal has invalidated value */
    if(COM_INDEX_DEFAULT != rxSignalPbPtr->comSignalInvValueIndex)
    {
        uint8 invHandleType = 0xff;
        boolean invalidated = TRUE;
        /* DL201432 */
        /* Get invalidated action type. */
        invHandleType = Com_GetFlagState(rxSignalLtPtr->comSignalLTFlag, COM_DATAINVACTION_MASK);

        /* poll all bytes in this uint8N signal. */
        /* DL201432 */
        for(cntr = 0; ((cntr < (uint8)signalSize) && (TRUE == invalidated)); cntr++)
        {
            /* if any rx byte for this uint8N signal is unequal to invalidated const value,
               the poll will be stop and invalidated is set to FALSE. */
            if( (pduDataPtr[cntr+rxSignalPbPtr->comSignalLSBPos]) 
              != (COM_CFG_SIGNAL8BIT_INVALIDVALUE(rxSignalPbPtr->comSignalInvValueIndex+cntr)))
            {
                invalidated = FALSE;
            }
        }
        
        /* if this signal is invalidated. */ 
        if(TRUE == invalidated)
        {
            /* if invalidated action type is replace. */
            if(COM_DATA_INVALIDACTION_REPLACE == invHandleType)
            {
                /* poll all this uint8N bytes to assign the init value. */
                for(cntr = rxSignalPbPtr->comSignalBufIndex; 
                     cntr < ((uint16)(signalSize) + rxSignalPbPtr->comSignalBufIndex); 
                     cntr++)
                {
                    Com_Signal8BitRuntimeBuff[cntr] = COM_CFG_SIGNAL8BIT_INITVALUE(cntr);
                }
                
                /* if this signal has normal rx notification function configured,
                   invoke this function. */
                Com_SignalRxNotif(rxSignalLtPtr)
                /* Set need not filter algorithm flag. */
                NeedFilter = FALSE;
            }
            /* if invalidated action type is notification. */
            else if(COM_DATA_INVALIDACTION_NOTIFY == invHandleType)
            {
                /* if this signal has invalidated rx notification function configured,
                   invoke this function. */
                Com_SignalRxInvNotif(rxSignalLtPtr)
                /* Set need not filter algorithm flag. */
                NeedFilter = FALSE;
            }else{/* if invalidated action type is nothing or illegal, do nothing. */}   
        }
    }/* if this signal has no invalidated value, do nothing. */

    /* if this signal need filter. */
    if(TRUE == NeedFilter)
    {
        /* Here, '!=COM_FILTER_FUNC_NEVER_INDEX' means 'COM_FILTER_FUNC_ALWAY_INDEX'
           or there is no filter mechanism */
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        if(COM_FILTER_FUNC_NEVER_INDEX != rxSignalPbPtr->comFilterFuncIndex)
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
            /* DL201431 */
            /* update all signal bytes into signal run time buffer. */
            Com_Update8NSignalBuff(pduDataPtr, cntr, signalSize, 
                                                  rxSignalPbPtr->comSignalBufIndex, 
                                                  rxSignalPbPtr->comSignalLSBPos, 
                                                  (Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK)))
            /* if this signal has normal rx notification function configured,
               invoke this function. */
            Com_SignalRxNotif(rxSignalLtPtr)
            /* if DM enabled, and signal DM switch is not 0xffff, update DM Counter value. */
            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            if(COM_RT_RXIPDUFLAG_ENABLEDM_MASK == (Com_GetFlagState(Com_RxIPduRTimeFlag[rxSignalPbPtr->comIPduRefIndex], COM_RT_RXIPDUFLAG_ENABLEDM_MASK)))
            {
                Com_InitRxSignalDM(rxSignalLtPtr, updateBitStat, rxSignalPbPtr->comSignalDMIndex)
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
        }
    }
    /* DL201418 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    else
    {
        /* if this signal need filter, Ipdu DM enabled, and signal 
           DM switch is not 0xffff, update DM Counter value. */
        if(COM_RT_RXIPDUFLAG_ENABLEDM_MASK == (Com_GetFlagState(Com_RxIPduRTimeFlag[rxSignalPbPtr->comIPduRefIndex], COM_RT_RXIPDUFLAG_ENABLEDM_MASK)))
        {
            Com_InitRxSignalDM(rxSignalLtPtr, updateBitStat, rxSignalPbPtr->comSignalDMIndex)
        }
    }
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

    return ;
    /* DL201431 */
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Deal with bool, uint8 uint16 and uint32 signal 
 *                     within Com_SignalRxIndication. 
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, reentrant
 *                     for different signals.
 * Param-Name[in]      pduDataPtr, rxSignalId, updateBitStat
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_RxSignalHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RxSignalHandle
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) pduDataPtr, 
    Com_SignalIdType rxSignalId 
    /* SW201430 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    ,uint8 updateBitStat
    #endif
    /* SW201430 */    
)
{    
    boolean useNeedOB = FALSE;
    boolean NeedFilter = TRUE;
    uint32 unpackRslt = 0xffffffffuL;
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(rxSignalId));
    P2CONST(Com_RxSignalLTType, AUTOMATIC, COM_CONST)
    rxSignalLtPtr = &(Com_RxSignalLT[rxSignalId]);

    /* unpack the signal value from rx ipdu ptr, and do B-End and L-End exchanging,
       and return the result as an uint32 value to varible 'unpackRslt'. */ 
    unpackRslt = Com_RxUnPack(rxSignalPbPtr->comSignalPBFlag, rxSignalPbPtr->comSignalLSBPos,
                              rxSignalPbPtr->comSignalMSBPos, pduDataPtr);

    /* check if signal has invalidated value */
    if(COM_INDEX_DEFAULT != (rxSignalPbPtr->comSignalInvValueIndex))
    {
        boolean invalidated = TRUE;
        uint8 invHandleType = 0xff;
        /* Get invalidated action type. */
        invHandleType = Com_GetFlagState(rxSignalLtPtr->comSignalLTFlag,
                                         COM_DATAINVACTION_MASK);
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* Get flag mark if the signal need old buffer. */
        useNeedOB = Com_GetFlagState(rxSignalLtPtr->comSignalLTFlag, 
                                     COM_RXSIGNAL_NEEDOLDBUFF_MASK);
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */

        /* This function return if the signal value is invalidated. */
        invalidated = Com_SignalInvalidateHandle(rxSignalId, unpackRslt);

        /* if this signal is invalidated. */
        if(TRUE == invalidated)
        {   
            /* if invalidated action type is replace. */
            if(COM_DATA_INVALIDACTION_REPLACE == invHandleType)
            {
                /* replace signal runtime buffer, old buffer(if exits), with init value. */
                Com_RxSignalReplaceHanlde(useNeedOB, rxSignalId, rxSignalPbPtr)
                /* if this signal has normal rx notification function configured,
                   invoke this function. */
                Com_SignalRxNotif(rxSignalLtPtr)
                /* Set need not filter algorithm flag. */
                NeedFilter = FALSE;
            }
            /* if invalidated action type is notification. */
            else if(COM_DATA_INVALIDACTION_NOTIFY == invHandleType)
            {
                /* if this signal has invalidated rx notification function configured,
                   invoke this function. */
                Com_SignalRxInvNotif(rxSignalLtPtr)
                /* Set need not filter algorithm flag. */
                NeedFilter = FALSE;
            }
            else{/* if invalidated action type is nothing or illegal, do nothing. */}   
        }else{/* if this signal is validated, do nothing. */}
    }/* if this signal has no invalidated value, do nothing. */

    /* if this signal need filter. */
    if(TRUE == NeedFilter)
    {
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        boolean filterPass = TRUE;
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */

        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* if the signal has filter algorithm. */
        if(COM_INDEX_DEFAULT != rxSignalPbPtr->comFilterFuncIndex)
        {
            /* execte filter, and return filter result. */
            filterPass = Com_FilterFunctionArray[rxSignalPbPtr->comFilterFuncIndex](unpackRslt, rxSignalId); 
        }
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */

        /* if filter passed or has no filter algorithm. */
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        if(TRUE == filterPass)
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
            /* update signal value into signal runtime buffer and old buffer(if exits). */
            Com_RxSignalBuffHanlde(useNeedOB, rxSignalPbPtr, unpackRslt)
            /* if this signal has normal rx notification function configured,
               invoke this function. */
            Com_SignalRxNotif(rxSignalLtPtr)
            /* if DM enabled, and signal DM switch is not 0xffff, update DM Counter value. */
            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            if(COM_RT_RXIPDUFLAG_ENABLEDM_MASK == (Com_GetFlagState(Com_RxIPduRTimeFlag[rxSignalPbPtr->comIPduRefIndex], COM_RT_RXIPDUFLAG_ENABLEDM_MASK)))
            {
                Com_InitRxSignalDM(rxSignalLtPtr, updateBitStat, rxSignalPbPtr->comSignalDMIndex)
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
        }   
    }
    /* DL201418 */
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    else
    {
        /* if this signal need filter, Ipdu DM enabled, and signal 
           DM switch is not 0xffff, update DM Counter value. */
        if(COM_RT_RXIPDUFLAG_ENABLEDM_MASK == (Com_GetFlagState(Com_RxIPduRTimeFlag[rxSignalPbPtr->comIPduRefIndex], COM_RT_RXIPDUFLAG_ENABLEDM_MASK)))
        {
            Com_InitRxSignalDM(rxSignalLtPtr, updateBitStat, rxSignalPbPtr->comSignalDMIndex)
        }
    }
    /* DL201418 */
    #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

    return ; 
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Signal Rx indication branch within Com_RxIndication. 
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, reentrant
 *                     for different signals.
 * Param-Name[in]      comRxPduId, pduInfoPtr
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_SignalRxIndication
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_SignalRxIndication
(
    PduIdType comRxPduId, 
    P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) pduInfoPtr
)
{ 
    uint16 Cntr = 0;
    uint16 signalID = 0;
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = NULL_PTR;

    /* DL201425 */
    /* poll all signals within this Ipdu. */
    for(Cntr = COM_CFG_RXSIGNAL_INDEX_START(comRxPduId); 
        Cntr <= COM_CFG_RXSIGNAL_INDEX_STOP(comRxPduId);
        Cntr++)
    {
        /* Signal id conversion, now the result of conversion is equal to index.
           But it may be different later. */
        signalID = COM_CFG_RXSIGNAL_ID(Cntr);
        rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(signalID));

        /* Check whether the rx ipdu length is longer than the signal end byte in this ipdu.
           if shorter, don't handle this signal. */
        if((rxSignalPbPtr->comSignalEndByte) <= (pduInfoPtr->SduLength))
        {
            uint8 NeedSignalDM = 0;/*if no updatebit, signal DM need not start */

            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            if(COM_INDEX_DEFAULT != (rxSignalPbPtr->comSignalUpdateBitPos))
            {
                /* if updatebit exists, only when (updatebit == 1), DM need start. */
                /* SW201411 */
                NeedSignalDM = GetSignalUpdatebit(rxSignalPbPtr, pduInfoPtr->SduDataPtr);
                /* SW201411 */
            }
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

            /* First, if there's no updatebit, signal will be handled. 
               Second, if there's updatebit and (updatebit==1), then NeedSignalDM should
               not equal zero. */
            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            if( (COM_INDEX_DEFAULT == (rxSignalPbPtr->comSignalUpdateBitPos)) || (NeedSignalDM>0) )
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
            {
                if( COM_RXSINGAL_TYPE_UNIT8_N
                 == Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag,COM_PBRXSIGNALTYPE_MASK))
                {
                    /* if the signal type is uint8N, then invoke the 'Com_Rx8NSignalHandle'
                       function to handle. */
                    Com_Rx8NSignalHandle( pduInfoPtr->SduDataPtr, signalID
                                                         /* SW201430 */
                                                         #if (STD_ON == COM_UPDATEBIT_ENABLE)
                                                         , NeedSignalDM
                                                         #endif
                                                         /* SW201430 */ );
                }
                else
                {
                    /* if the signal type is not uint8N, then invoke the 'Com_RxSignalHandle'
                       function to handle. */
                    Com_RxSignalHandle( pduInfoPtr->SduDataPtr, signalID
                                                     /* SW201430 */
                                                     #if (STD_ON == COM_UPDATEBIT_ENABLE)
                                                     , NeedSignalDM
                                                     #endif
                                                     /* SW201430 */ );
                }
            }


        }
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


/*************************************************************************/
/*
 * Brief               Signal group Rx indication branch within                     
 *                     Com_RxIndication.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant
 *                     for different signal group.
 * Param-Name[in]      ComSignalGrpId, PduInfoPtr
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_SignalGroupRxIndication
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_SignalGroupRxIndication
(
    Com_SignalGroupIdType ComSignalGrpId, 
    P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr
)
{ 
    #define IPDUID COM_CFG_RXSIGNALGROUP_IPDUIDREF(ComSignalGrpId)
    #define SIGNALGRPINVFLAG (rxSignalGrpLtPtr->comSignalGroupLTFlag)
    #define GRPSIGNALINDSTART (rxSignalGrpLtPtr->comRxGroupSignalIndexStart)
    #define GRPSIGNALINDSTOP (rxSignalGrpLtPtr->comRxGroupSignalIndexStop)
    #define SIGNALDMSWITCH (rxSignalGrpPbPtr->comSignalGroupDMIndex)
    #define IPDUDMFLAG Com_GetFlagState(Com_RxIPduRTimeFlag[IPDUID], COM_RT_RXIPDUFLAG_ENABLEDM_MASK)

    P2CONST(Com_RxSignalGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalGrpPbPtr = &(COM_PTR_RXSIGGRPPB(ComSignalGrpId));
    P2CONST(Com_RxSignalGroupLTType, AUTOMATIC, COM_CONST)
    rxSignalGrpLtPtr = &(Com_RxSignalGroupLT[ComSignalGrpId]);

    /* Check whether the rx ipdu length is longer than the signal group end byte in this ipdu.
       if shorter, don't handle this signal. */
    if((rxSignalGrpPbPtr->comSignalGroupEndByte) <= (PduInfoPtr->SduLength))
    {
        /* DL201418 */
        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        uint8 updateBit = 0;
        /* DL201418 */
        #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

        /* DL201418 */
        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        /* if the signal group has update bit. */
        if(COM_INDEX_DEFAULT != (rxSignalGrpPbPtr->comUpdateBitPos))
        {
            /* get update bit value. */
            /* SW201411 */
            updateBit = GetSignalGrpUpdatebit(ComSignalGrpId, PduInfoPtr->SduDataPtr);
            /* SW201411 */
        }
        /* DL201418 */
        #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

        /* DL201418 */
        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        /* if signal group has update bit and updatebit >0 , or hasn't update bit. */
        if( (COM_INDEX_DEFAULT == (rxSignalGrpPbPtr->comUpdateBitPos))
           ||( (updateBit>0) 
             &&(COM_INDEX_DEFAULT!=(rxSignalGrpPbPtr->comUpdateBitPos))))
        /* DL201418 */
        #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
        {

            boolean normalNotify = TRUE;
            uint8 invHandleType = 0xff;
            boolean invalidRst = FALSE;
            uint16 grpSignalID = 0;
            uint32 unpackRslt = 0xffffffffuL;
            P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
            rxGrpSignalPbPtr = NULL_PTR;

            /* Get this signal group invalidate type. */
            invHandleType = Com_GetFlagState(SIGNALGRPINVFLAG, COM_DATAINVACTION_MASK);
            
            SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
            /* This 'for cycling' check whether any group signal invalidated. */
            for(grpSignalID = GRPSIGNALINDSTART; grpSignalID <= GRPSIGNALINDSTOP;
                grpSignalID++)
            {
                invalidRst = FALSE;
                rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(grpSignalID));

                /* if group signal type is uint8N, 
                   the siganl need not do B-end and L-end conversion. */
                if( COM_RXSINGAL_TYPE_UNIT8_N
                 != Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag,COM_PBRXSIGNALTYPE_MASK))
                {
                    /* unpack signal and return the result. */
                    unpackRslt = Com_RxUnPack(rxGrpSignalPbPtr->comGroupSignalPBFlag, 
                                                              rxGrpSignalPbPtr->comGroupSignalLSBPos,
                                                              rxGrpSignalPbPtr->comGroupSignalMSBPos, 
                                                              PduInfoPtr->SduDataPtr);
                }

                /* if group signal invalidate handle type is notification or replace, 
                   check if the group signal is invalidated. */
                if( (COM_DATA_INVALIDACTION_NOTIFY == invHandleType)
                  ||(COM_DATA_INVALIDACTION_REPLACE == invHandleType) )
                {
                    /* get invalidated check result. */
                    invalidRst = Com_GrpSignalInvalidateHandle(PduInfoPtr->SduDataPtr, grpSignalID, unpackRslt);
                }

                /* if group signal is not invalidated. */
                if(FALSE == invalidRst)
                {
                    /* update group signal run time buffer. */
                    Com_UpdateGrpSignalValue(PduInfoPtr->SduDataPtr, grpSignalID, unpackRslt);
                }
                else
                {
                    /* MISRA-C:2004 Rule 13.6,
                    * Msg(4:2469) Loop control variable in this 'for' statement, grpSignalID, is modified in the body of the loop.
                    * Reason: Convenient for jump out of loop. */
                    /* if any group signal is invalidated, the poll will be ended. */
                    grpSignalID = GRPSIGNALINDSTOP + 1u;
                } 
            }
            SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);

            /* if any group signal is invalidated. */
            if(TRUE == invalidRst)
            {
                /* if signal group invalidated handling type is replace. */
                if(COM_DATA_INVALIDACTION_REPLACE == invHandleType)
                {
                    SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
                    Com_ReplaceGrpSignalsValue(ComSignalGrpId); 
                    SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
                }
                /* if signal group invalidated handling type is notification. */
                else if(COM_DATA_INVALIDACTION_NOTIFY == invHandleType)
                {
                    /* if signal group invalidated notification function was configured. */
                    if(NULL_PTR != (rxSignalGrpLtPtr->comSignalGroupCbkRxInvFnc))
                    {    
                        /* invoke invalidated notification function. */ 
                        rxSignalGrpLtPtr->comSignalGroupCbkRxInvFnc();
                    } 

                    /* poll all the group signal with this signal group */
                    for(grpSignalID = rxSignalGrpLtPtr->comRxGroupSignalIndexStart;
                        grpSignalID <= rxSignalGrpLtPtr->comRxGroupSignalIndexStop;
                        grpSignalID++)
                    {
                        /* if this group signal configured invalidated notification function. */
                        if(NULL_PTR != (Com_RxGroupSignalLT[grpSignalID].comGroupSignalCbkRxInvFunc))
                        {
                            /* invoke the group signal invalidated notification function. */ 
                            Com_RxGroupSignalLT[grpSignalID].comGroupSignalCbkRxInvFunc();
                        }
                    }

                    SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
                    /* recover all group signal runtime buffer with shadowbuffer value. */
                    Com_RecoverGrpSignalsValue(ComSignalGrpId); 
                    SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
                    /* set normal notification function invoking flag to FALSE. */
                    normalNotify = FALSE;
                }else{}
            }
            /* DL201425 */

            /*  if normal notification function invoking flag is TRUE.  */
            if(TRUE == normalNotify)
            {
                /*  if normal notification function configured.  */
                if(NULL_PTR != rxSignalGrpLtPtr->comSignalGroupCbkRxAckFnc)
                {
                    /* invoke the normal notification function. */ 
                    rxSignalGrpLtPtr->comSignalGroupCbkRxAckFnc();
                }
            }

            /* DL201418 */
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            /* if signal group update bit existed, and update bit is not zero,
               and signal group DM index valid, and ipdu DM enabled. */
            if( (1==updateBit) 
              &&(COM_INDEX_DEFAULT != SIGNALDMSWITCH)
              &&(COM_RT_RXIPDUFLAG_ENABLEDM_MASK == IPDUDMFLAG))
            {
                /* update this signal group DM counter. */
                Com_RxUpdateSigGrpRTimeDMCntr[rxSignalGrpPbPtr->comSignalGroupDMIndex] =
                rxSignalGrpLtPtr->comSignalGroupDMCntr;
            }
            /* DL201418 */
            #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */
        }
    }

    return ;
    
    #undef SIGNALGRPINVFLAG 
    #undef GRPSIGNALINDSTART 
    /* DL201425 */
    #undef GRPSIGNALINDSTOP
    #undef SIGNALDMSWITCH
    #undef IPDUID
    #undef IPDUDMFLAG
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Arbitrate whether a signal is invalidated in                     
 *                     Com_SendSignal.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant
 *                     for different signal group.
 * Param-Name[in]      signalID, signalV
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean
 * PreCondition        None
 * CallByAPI           Com_SignalInvalidateHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_SignalInvalidateHandle(uint16 signalID, uint32 signalV)
{
    boolean rtnVal = FALSE;
    uint16 signalInvalidValueIndex = COM_CFG_RXSIGNAL_INVALIDVALUE_INDEX(signalID);

    switch(Com_GetFlagState(COM_CFG_RXSIGNAL_PBFLAG(signalID),COM_PBRXSIGNALTYPE_MASK))
    {
        case COM_RXSIGNAL_TYPE_BOOLEAN:
            if(((boolean)signalV) == COM_CFG_SIGNALBOOL_INVALIDVALUE(signalInvalidValueIndex))
            {
                rtnVal = TRUE;
            }
            break;

        case COM_RXSIGNAL_TYPE_SINT8:
        case COM_RXSIGNAL_TYPE_UINT8:
            if(((uint8)signalV) == COM_CFG_SIGNAL8BIT_INVALIDVALUE(signalInvalidValueIndex))
            {
                rtnVal = TRUE;
            }
            break;

        case COM_RXSIGNAL_TYPE_SINT16:
        case COM_RXSIGNAL_TYPE_UINT16:
            if(((uint16)signalV) == COM_CFG_SIGNAL16BIT_INVALIDVALUE(signalInvalidValueIndex))
            {
                rtnVal = TRUE;
            }
            break;

        case COM_RXSIGNAL_TYPE_UINT32:
        case COM_RXSIGNAL_TYPE_SINT32:
            if(((uint32)signalV) == COM_CFG_SIGNAL32BIT_INVALIDVALUE(signalInvalidValueIndex))
            {
                rtnVal = TRUE;
            }
            break;

        default:
            break;
    }
        
    return rtnVal;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Arbitrate whether any group signal is invalidated  
 *                     within a specific signal group in 
 *                     Com_SendSignalGroup.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant
 *                     for different signal group.
 * Param-Name[in]      rxPduPtr, grpSignalID, signalV
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              boolean
 * PreCondition        None
 * CallByAPI           Com_GrpSignalInvalidateHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(boolean, COM_CODE)
Com_GrpSignalInvalidateHandle
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) rxPduPtr, 
    uint16 grpSignalID, 
    uint32 signalV
)
{
    #define GRPSIGNALPOSINPDU (COM_CFG_RXGRPSIG_LSBPOS(grpSignalID))
    
    boolean rtnVal = TRUE;
    uint8 cntr = 0;
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(grpSignalID));
    
    /* group signal has invalidated mechanism. */
    if(COM_INDEX_DEFAULT != rxGrpSignalPbPtr->comGroupSignalInvValueIndex)
    {
        switch(Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag,COM_PBRXSIGNALTYPE_MASK))
        {
            case COM_RXSIGNAL_TYPE_BOOLEAN:
                if(((boolean)signalV) !=
                    COM_CFG_SIGNALBOOL_INVALIDVALUE(rxGrpSignalPbPtr->comGroupSignalInvValueIndex))
                {
                    rtnVal = FALSE;
                }
                break;

            case COM_RXSIGNAL_TYPE_SINT8:
            case COM_RXSIGNAL_TYPE_UINT8:
                if(((uint8)signalV) !=
                    COM_CFG_SIGNAL8BIT_INVALIDVALUE(rxGrpSignalPbPtr->comGroupSignalInvValueIndex))
                {
                    rtnVal = FALSE;
                }
                break;

            case COM_RXSIGNAL_TYPE_SINT16:
            case COM_RXSIGNAL_TYPE_UINT16:
                if(((uint16)signalV) !=
                    COM_CFG_SIGNAL16BIT_INVALIDVALUE(rxGrpSignalPbPtr->comGroupSignalInvValueIndex))
                {
                    rtnVal = FALSE;
                }
                break;

            case COM_RXSIGNAL_TYPE_UINT32:
            case COM_RXSIGNAL_TYPE_SINT32:
                if(((uint32)signalV) !=
                    COM_CFG_SIGNAL32BIT_INVALIDVALUE(rxGrpSignalPbPtr->comGroupSignalInvValueIndex))
                {
                    rtnVal = FALSE;
                }
                break;

            case COM_RXSINGAL_TYPE_UNIT8_N:
                {
                    /* DL201434 */
                    uint8 signalSize = 0u;

                    if(rxGrpSignalPbPtr->comGroupSignalLSBPos < rxGrpSignalPbPtr->comGroupSignalMSBPos)
                    {
                        signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalMSBPos - rxGrpSignalPbPtr->comGroupSignalLSBPos) + 1u);

                        for(cntr = 0; ((cntr < signalSize) && (TRUE == rtnVal)); cntr++)
                        {
                            if( rxPduPtr[GRPSIGNALPOSINPDU + cntr]
                                != COM_CFG_SIGNAL8BIT_INVALIDVALUE(rxGrpSignalPbPtr->comGroupSignalInvValueIndex + cntr))
                            {
                                rtnVal = FALSE;
                            }
                        }
                    }
                    else
                    {
                        signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalLSBPos - rxGrpSignalPbPtr->comGroupSignalMSBPos) + 1u);

                        for(cntr = 0; (cntr < signalSize) && (TRUE == rtnVal); cntr++)
                        {
                            if( rxPduPtr[GRPSIGNALPOSINPDU - cntr]
                                != COM_CFG_SIGNAL8BIT_INVALIDVALUE(rxGrpSignalPbPtr->comGroupSignalInvValueIndex + cntr))
                            {
                                rtnVal = FALSE;
                            }
                        }
                    }
                    /* DL201434 */


                }

                break;

            default:
                break;
        }
    }
    
    return rtnVal;
    
    #undef GRPSIGNALPOSINPDU
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Replace group signals buffer with init const value  
 *                     in Com_SendSignalGroup.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant 
 *                     for different signal group.
 * Param-Name[in]      signalId
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_ReplaceGrpSignalsValue
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_ReplaceGrpSignalsValue(uint16 signalGrpId)
{
    #define SIGNALTYPE Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag,COM_PBRXSIGNALTYPE_MASK)
    #define VALUEINDEX (rxGrpSignalPbPtr->comGroupSignalBufIndex)
    
    uint16 grpSignalID = 0;
    uint16 cntr = 0;
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = NULL_PTR;

    /* DL201425 */
    for(grpSignalID = Com_RxSignalGroupLT[signalGrpId].comRxGroupSignalIndexStart;
        grpSignalID <= Com_RxSignalGroupLT[signalGrpId].comRxGroupSignalIndexStop;
        grpSignalID++)
    {
        rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(grpSignalID));
        switch(SIGNALTYPE)
        {
            case COM_RXSIGNAL_TYPE_BOOLEAN:
                Com_ReplaceGrpSignalbuff(Bool, BOOL, VALUEINDEX);
                break;

            case COM_RXSIGNAL_TYPE_SINT8:
            case COM_RXSIGNAL_TYPE_UINT8:
                Com_ReplaceGrpSignalbuff(8Bit, 8BIT, VALUEINDEX);
                break;

            case COM_RXSIGNAL_TYPE_SINT16:
            case COM_RXSIGNAL_TYPE_UINT16:
                Com_ReplaceGrpSignalbuff(16Bit, 16BIT, VALUEINDEX);
                break;

            case COM_RXSIGNAL_TYPE_UINT32:
            case COM_RXSIGNAL_TYPE_SINT32:
                Com_ReplaceGrpSignalbuff(32Bit, 32BIT, VALUEINDEX);
                break;

            case COM_RXSINGAL_TYPE_UNIT8_N:
                {
                    /* DL201434 */
                    uint8 signalSize = 0u;

                    /* DL201434 */
                    if(rxGrpSignalPbPtr->comGroupSignalLSBPos < rxGrpSignalPbPtr->comGroupSignalMSBPos)
                    {
                        signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalMSBPos - rxGrpSignalPbPtr->comGroupSignalLSBPos) + 1u);
                    }
                    else
                    {
                       signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalLSBPos - rxGrpSignalPbPtr->comGroupSignalMSBPos) + 1u);
                    }
                    /* DL201434 */

                    for(cntr = VALUEINDEX; cntr < (VALUEINDEX + signalSize); cntr++)
                    {
                        Com_RxGroupSignal8BitRtimeBuff[cntr] =
                           COM_CFG_RXGRPSIG8BIT_INITVALUE(cntr);
                    }
                }
                break;

            default:
                break;
        }/*switch(signalType)*/
    }

    return ;

    #undef VALUEINDEX
    #undef SIGNALTYPE
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


/*************************************************************************/
/*
 * Brief               Replace signal buffer with init const value for a  
 *                     in Com_SendSignal
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, reentrant for
 *                     different signals.
 * Param-Name[in]      signalId
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_ReplaceSignalValue
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_ReplaceSignalValue(uint16 signalId)
{     
    boolean useNeedOB = FALSE;
    uint16 u8nArrInd = 0;
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(signalId));

    /* DL201419 */
    #if (STD_ON == COM_FILTER_ENABLE)
    useNeedOB = Com_GetFlagState(Com_RxSignalLT[signalId].comSignalLTFlag, COM_RXSIGNAL_NEEDOLDBUFF_MASK);
    /* DL201419 */
    #endif    /* STD_ON == COM_FILTER_ENABLE */
    
    switch(Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag,COM_PBRXSIGNALTYPE_MASK))              
    {
        case COM_RXSIGNAL_TYPE_BOOLEAN:
            Com_ReplaceSignalbuff(Bool, BOOL, useNeedOB, rxSignalPbPtr)
            break;

        case COM_RXSIGNAL_TYPE_SINT8:
        case COM_RXSIGNAL_TYPE_UINT8:
            Com_ReplaceSignalbuff(8Bit, 8BIT, useNeedOB, rxSignalPbPtr)
            break;

        case COM_RXSIGNAL_TYPE_SINT16:
        case COM_RXSIGNAL_TYPE_UINT16:
            Com_ReplaceSignalbuff(16Bit, 16BIT, useNeedOB, rxSignalPbPtr)
            break;

        case COM_RXSIGNAL_TYPE_UINT32:
        case COM_RXSIGNAL_TYPE_SINT32:
            Com_ReplaceSignalbuff(32Bit, 32BIT, useNeedOB, rxSignalPbPtr)
            break;

        case COM_RXSINGAL_TYPE_UNIT8_N:
            {
                /* DL201434 */
                uint8 signalSize = 0u;
                Com_RxGroupSignalPBType * rxGrpSignalPBPtr = (Com_RxGroupSignalPBType *)(&(COM_PTR_RXGRPSIGPB(signalId)));

                /* DL201434 */
                if(rxGrpSignalPBPtr->comGroupSignalLSBPos < rxGrpSignalPBPtr->comGroupSignalMSBPos)
                {
                    signalSize = (uint8)((rxGrpSignalPBPtr->comGroupSignalMSBPos - rxGrpSignalPBPtr->comGroupSignalLSBPos) + 1u);
                }
                else
                {
                   signalSize = (uint8)((rxGrpSignalPBPtr->comGroupSignalLSBPos - rxGrpSignalPBPtr->comGroupSignalMSBPos) + 1u);
                }

                /* DL201434 */
                for(u8nArrInd = rxSignalPbPtr->comSignalBufIndex; u8nArrInd < (rxSignalPbPtr->comSignalBufIndex + signalSize); u8nArrInd++)
                {
                    Com_Signal8BitRuntimeBuff[u8nArrInd] =
                    COM_CFG_SIGNAL8BIT_INITVALUE(u8nArrInd);
                }
            }
            break;

        default:
            break;
    }

    return ;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Recover group signal value from group signal shadow   
 *                     buffer for a specific signal group in 
 *                     Com_SendSignalGroup.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant
 *                     for different signal groups.
 * Param-Name[in]      rxPduPtr, grpSignalId, unpackRslt
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_RecoverGrpSignalsValue
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_RecoverGrpSignalsValue(uint16 signalGrpId)
{
    #define SIGNALTYPE Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag,COM_PBRXSIGNALTYPE_MASK)
    #define VALUEINDEX (rxGrpSignalPbPtr->comGroupSignalBufIndex)
    
    uint16 grpSignalID = 0;
    uint16 cnt = 0;
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(signalGrpId));

    for(grpSignalID = Com_RxSignalGroupLT[signalGrpId].comRxGroupSignalIndexStart;
        grpSignalID <= Com_RxSignalGroupLT[signalGrpId].comRxGroupSignalIndexStop;
        grpSignalID++)
    {
        switch(SIGNALTYPE)
        {
            case COM_RXSIGNAL_TYPE_BOOLEAN:
                Com_RecoverGrpSignalbuff(Bool, VALUEINDEX);
                break;

            case COM_RXSIGNAL_TYPE_SINT8:
            case COM_RXSIGNAL_TYPE_UINT8:
                Com_RecoverGrpSignalbuff(8Bit, VALUEINDEX);
                break;

            case COM_RXSIGNAL_TYPE_SINT16:
            case COM_RXSIGNAL_TYPE_UINT16:
                Com_RecoverGrpSignalbuff(16Bit, VALUEINDEX);
                break;

            case COM_RXSIGNAL_TYPE_UINT32:
            case COM_RXSIGNAL_TYPE_SINT32:
                Com_RecoverGrpSignalbuff(32Bit, VALUEINDEX);
                break;

            case COM_RXSINGAL_TYPE_UNIT8_N:
                {
                    /* DL201434 */
                    uint8 signalSize = 0u;

                    if(rxGrpSignalPbPtr->comGroupSignalLSBPos < rxGrpSignalPbPtr->comGroupSignalMSBPos)
                    {
                        signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalMSBPos - rxGrpSignalPbPtr->comGroupSignalLSBPos) + 1u);
                    }
                    else
                    {
                        signalSize = (uint8)((rxGrpSignalPbPtr->comGroupSignalLSBPos - rxGrpSignalPbPtr->comGroupSignalMSBPos) + 1u);
                    }
                    /* DL201434 */

                    for(cnt = VALUEINDEX; cnt < (VALUEINDEX + signalSize); cnt++)
                    {
                        Com_RxGroupSignal8BitRtimeBuff[cnt] =
                        Com_RxShadowSignal8BitRTimeBuff[cnt];
                    }
                }
                break;

            default:
                break;
        }/*switch(signalType)*/
    }

    return ;

    #undef VALUEINDEX
    #undef SIGNALTYPE
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"


/*************************************************************************/
/*
 * Brief               Update group signal value into group signal buffer  
 *                     for a specific signal group in Com_SendSignalGroup
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant
 *                     for different signal groups.
 * Param-Name[in]      rxPduPtr, grpSignalId, unpackRslt
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_UpdateGrpSignalValue
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_UpdateGrpSignalValue
(
    P2CONST(uint8, AUTOMATIC, COM_APPL_DATA) rxPduPtr, 
    uint16 grpSignalId, 
    uint32 unpackRslt
)
{
    #define SIGNALTYPE Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag,COM_PBRXSIGNALTYPE_MASK)
    #define GRPSIGNALPOSINPDU (rxGrpSignalPbPtr->comGroupSignalLSBPos)
    #define VALUEINDEX (rxGrpSignalPbPtr->comGroupSignalBufIndex) 
    /* DL201431 */
    #define SIGNALENDIANESS (Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBRXSIGENDIANESS_MASK))
    /* DL201431 */
    
    uint8 cnt = 0;
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(grpSignalId));

    switch(SIGNALTYPE)
    {
        case COM_RXSIGNAL_TYPE_BOOLEAN:
            Com_UpdateGrpSignalBuffM(Bool, grpSignalId, (boolean)unpackRslt);
            break;

        case COM_RXSIGNAL_TYPE_SINT8:
        case COM_RXSIGNAL_TYPE_UINT8:
            Com_UpdateGrpSignalBuffM(8Bit, grpSignalId, (uint8)unpackRslt);
            break;

        case COM_RXSIGNAL_TYPE_SINT16:
        case COM_RXSIGNAL_TYPE_UINT16:
            Com_UpdateGrpSignalBuffM(16Bit, grpSignalId, (uint16)unpackRslt);
            break;

        case COM_RXSIGNAL_TYPE_UINT32:
        case COM_RXSIGNAL_TYPE_SINT32:
            Com_UpdateGrpSignalBuffM(32Bit, grpSignalId, (uint32)unpackRslt);
            break;

        case COM_RXSINGAL_TYPE_UNIT8_N:
            /* DL201431 */
            {
                /* SW201450 */
                /* DL201434 */			
                uint16 signalSize = 0u;

                if(rxGrpSignalPbPtr->comGroupSignalLSBPos < rxGrpSignalPbPtr->comGroupSignalMSBPos)
                {
                    signalSize = (rxGrpSignalPbPtr->comGroupSignalMSBPos - rxGrpSignalPbPtr->comGroupSignalLSBPos) + 1u;
                }
                else
                {
                    signalSize = (rxGrpSignalPbPtr->comGroupSignalLSBPos - rxGrpSignalPbPtr->comGroupSignalMSBPos) + 1u;
                }
                /* DL201434 */

                /* SW201451 */
                if(COM_RXSIGNAL_ENDIANESS_BIG == SIGNALENDIANESS)                                                               
                {                                                                                                                
                    for(cnt = 0u; cnt < signalSize; cnt++)                                                           
                    {                                                                                                            
                        Com_RxGroupSignal8BitRtimeBuff[VALUEINDEX + cnt] = (rxPduPtr)[GRPSIGNALPOSINPDU - cnt];                
                    }                                                                                                            
                }                                                                                                                
                else                                                                                                             
                {                                                                                                                
                    for(cnt = 0u; cnt < signalSize; cnt++)                                                           
                    {                                                                                                            
                        Com_RxGroupSignal8BitRtimeBuff[VALUEINDEX + cnt] = (rxPduPtr)[GRPSIGNALPOSINPDU + cnt];                
                    }                                                                                                            
                }
                /* SW201451 */
                /* SW201450 */
            }
            break;

        default:
            break;
    }

    return ;

    #undef GRPSIGNALPOSINPDU
    #undef VALUEINDEX
    #undef SIGNALTYPE
    /* DL201431 */
    #undef SIGNALENDIANESS
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Deal with the MDT, DM, PeriodTimer, N-Times timer, 
 *                     N-Times N of Ipdu to which the signal belong
 *                     in Com_SendSignal.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal , reentrant for
 *                     different signals.
 * Param-Name[in]      signalId, ipduPrm
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_IpduHandleInSendSignal
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201458 */
STATIC FUNC(void, COM_CODE)
Com_IpduHandleInSendSignal
(
    Com_SignalIdType signalId, 
    /* SW201415 */
    #if (STD_ON == COM_GATEWAY_ENABLE)
    boolean isDescId,
    boolean isGtwSend,
    #endif
    /* SW201415 */
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define TXPROP Com_GetFlagState(txSigOrDescPbFlag, COM_PBTXPROP_MASK)

    uint8 txSigOrDescPbFlag;
    PduIdType ipduId;
    Com_TxIPduCOutFuncIndexLTType txIpduCalloutLtInd = 0;
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRTStatePtr = NULL_PTR;
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPBPtr = NULL_PTR;
    P2VAR(Com_TxIPduFlagRTType, AUTOMATIC, COM_VAR)
    txIpduRTFlagPtr = NULL_PTR;
    

    #if (STD_ON == COM_GATEWAY_ENABLE)
    if(TRUE == isDescId)
    {
        ipduId = COM_PTR_GWDESTDESCPB(signalId).comGwDestIPduRefIndex;
        txSigOrDescPbFlag = COM_PTR_GWDESTDESCPB(signalId).comGwDestFlag;
    }
    else
    #endif
    {
        ipduId = COM_PTR_TXSIGNALPB(signalId).comIPduRefIndex;
        txSigOrDescPbFlag = COM_PTR_TXSIGNALPB(signalId).comSignalPBFlag;	
    }

    txIpduRTStatePtr = &(Com_TxIPduRTimeState[ipduId]);
    txIpduRTFlagPtr = &(Com_TxIPduRTimeFlag[ipduId]);
    txIpduPBPtr = &(COM_PTR_TXIPDUPB(ipduId));
    txIpduCalloutLtInd = Com_TxIPduCalloutLT[ipduId];

    /* MDT wasn't time-out. */
    if(0 != txIpduRTStatePtr->txMDTCntr)
    {
        /* DL201419, if no filter tmChanged alway is FALSE */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* if TM changed, Set 'COM_RT_TXIPDUFLAG_TMSCHAINMDT' for Com_MainFunctionTx.
           In the same time, handle the N-Times timer counter, N-Times N and PT. */
        if(TRUE == ipduPrm->tmChanged)
        {
            /* DL201413, DL201417 */
            /* Set 'COM_RT_TXIPDUFLAG_TMSCHAINMDT' for Com_MainFunctionTx. */
            Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_TMSCHAINMDT);
            /* DL201417 */

            /* Set 'COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK' for Com_MainFunctionTx. */
            /* TM Changed, only send Pending signal or TriggerOnChange without change
             * in Direct TxMode could not send out IPDU */
            if((COM_TX_MODE_DIRECT != (ipduPrm->ipduTxMode)) || (COM_TX_PROP_TRIGGERED == (Com_GetFlagState(txSigOrDescPbFlag, COM_PBTXPROP_MASK)))
                || ((COM_TX_PROP_TRIGGERED_ON_CHANGE == (Com_GetFlagState(txSigOrDescPbFlag, COM_PBTXPROP_MASK))) && (TRUE == ipduPrm->signalChanged)))
            {
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);

                /* DL201410 */
                /* Clear COM_RT_TXIPDUFLAG_DELAYPENDTX before */
                Com_ClearFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_DELAYPENDTX);
                /* DL201410 */
            }
            /* DL201413 */

            /* handle the N-Times timer counter, N-Times N and PT. */
            /* SW201416 */
            Com_IpduHdlBefMDTForSignal(ipduId, txSigOrDescPbFlag, ipduPrm);
            /* SW201416 */

            /* DL201410 */
            /* TMS Changes to Mixed, and Signal is Pending, set COM_RT_TXIPDUFLAG_DELAYPENDTX,
             * because MainFunction send out IPdu is Periodic component IPdu */
            if((COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
              && ((Com_GetFlagState(txSigOrDescPbFlag, COM_PBTXPROP_MASK)) == COM_TX_PROP_PENDING))
            {
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_DELAYPENDTX);
            }
            /* DL201410 */
        }
        else
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
             /*   TOC == TriggerOnChange, T == Trigger, P == Pending,     *
              *   O == need transmit, X == no need transmint,                  *
              *   C == changed, NC = not changed.                                 *
              *   Below truth table only valid for Direct and Mix TM.            *
              *    ___________________________                                  *
              *   |___T___|____TOC____|___P___|                               *
              *   |           |__C__|_NC__|            |                               *
              *   |           |        |         |            |                              *
              *   |     O    |        |         |     X     |                              *
              *   |           |  O    |   X    |            |                              *
              *   |           |        |         |            |                              *
              *   |_______|____ |______|_______|                              *
              *                                                                                *
              *   According to above truth table, when the value is 'O',     *
              *   the flag 'COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK' and   *
              *   'COM_RT_TXIPDUFLAG_DELAY_MASK' will be set, and       *
              *   Ipdu's N-Times N and N-Times Timer Counter will be        *
              *   clear.                                                                     */
            if( ( (COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
                || (COM_TX_MODE_DIRECT == (ipduPrm->ipduTxMode)))
              &&( ((Com_GetFlagState(txSigOrDescPbFlag, COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED)
                ||( ((Com_GetFlagState(txSigOrDescPbFlag, COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                  &&(TRUE == ipduPrm->signalChanged))))
            {
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);
            }
        }
    }
    /* MDT has been time-out. */
    else
    { 
        PduInfoType PduInfo;
        PduInfo.SduLength = txIpduPBPtr->comIPduSize;
        PduInfo.SduDataPtr = &(Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]);

        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* under situation of TM==Period and TM changed. */
        if((COM_TX_MODE_PERIODIC == (ipduPrm->ipduTxMode)) && (TRUE == (ipduPrm->tmChanged)))
        {
            /* Clear N-Times N and N-Times Timer Counter*/
            txIpduRTStatePtr->txRmnTimesOfN = 0; 
            txIpduRTStatePtr->txNTimesPDCntr = 0;
            /* Set PT to be configured value. */
            txIpduRTStatePtr->txPDCntr = ipduPrm->PeriodCntr;

            /* if this ipdu don't configuration transmit callback function,
               or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLtInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLtInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLtInd](ipduId, PduInfo.SduDataPtr))) )
            {
                /* call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                /* SW201415 */
                #if (STD_ON == COM_GATEWAY_ENABLE)
                if(TRUE == isGtwSend)
                {
                    Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                }
                else
                #endif
                /* SW201415 */
                {
                    if(E_OK == PduR_ComTransmit(txIpduPBPtr->comLowLayerPduId, &PduInfo))
                    {
                        /* DL201422 */
                        #if(STD_ON == COM_UPDATEBIT_ENABLE)
                        /* Clear updatebit of this IPdu Signal & SignalGroup */
                        Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                        #endif
                        /* DL201422 */
                     }
                }
               
                /* if Ipdu DM counter is equal to zero. */
                if(0 == (txIpduRTStatePtr->txDMCntr))
                {
                    /* set Ipdu DM counter to be configured value. */
                    txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                }
                /* set Ipdu MDT counter to be configured value. */
                txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                
                /* DL201406 */
                /* Set need confirm flag */
                Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                /* DL201406 */
            }
        }
        /* under situation of TM==Mix and TM changed. */
        else if((COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode)) && (TRUE == (ipduPrm->tmChanged)))
        {
            /* Clear N-Times timer counter and N-Times N counter */
            txIpduRTStatePtr->txRmnTimesOfN = 0; 
            txIpduRTStatePtr->txNTimesPDCntr = 0;
            /* Because TM changed to Mix, so the PT will be initialized with configured value. */
            txIpduRTStatePtr->txPDCntr = ipduPrm->PeriodCntr;

            /* if this ipdu don't configuration transmit callback function,
               or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLtInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLtInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLtInd](ipduId, PduInfo.SduDataPtr))) )
            {
                /* Because TM changed to Mix, so the com should transmit both 
                   N-Times Ipdu and Period Ipdu as well, but here two ipdu was 
                   combined to one Tx Ipdu.
                   call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                 /* SW201415 */
                #if (STD_ON == COM_GATEWAY_ENABLE)
                if(TRUE == isGtwSend)
                {
                    Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                }
                else
                #endif
                /* SW201415 */
                {
                    if(E_OK == PduR_ComTransmit(txIpduPBPtr->comLowLayerPduId, &PduInfo))
                    {
                        /* DL201422 */
                        #if(STD_ON == COM_UPDATEBIT_ENABLE)
                        /* Clear updatebit of this IPdu Signal & SignalGroup */
                        Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                        #endif
                        /* DL201422 */
                     }
                }
				
                /*   TOC == TriggerOnChange, T == Trigger, P == Pending,     *
                 *   O == need transmit, X == no need transmint,             *
                 *   C == changed, NC = not changed.                         *
                 *    ___________________________                            *
                 *   |___T___|____TOC____|___P___|                           *
                 *   |            |__C__|_NC__|           |                           *
                 *   |            |        |         |           |                           *
                 *   |      O    |        |         |   X      |                           *
                 *   |            |  O    |  X     |           |                           *
                 *   |            |        |         |           |                           *
                 *   |_______|______|______|______|                           *
                 *                                                           *
                 *   According to above truth table, when the value is       *
                 *   'O', Ipdu's N-Times N and N-Times Timer Counter will    *
                 *   be clear, and the DM counter will be set to be          *
                 *   configured value according to situation.                */
                if( (TXPROP == COM_TX_PROP_TRIGGERED) 
                  ||( (TXPROP == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                    &&(TRUE == ipduPrm->signalChanged)))
                {
                    /* Set N-Times N and N-Times timer with configured value. */
                    txIpduRTStatePtr->txRmnTimesOfN = ipduPrm->rptNum; 
                    txIpduRTStatePtr->txNTimesPDCntr = ipduPrm->NTimeCntr;

                    /* if Ipdu DM counter is equal to zero and N-Times N>0. */
                    if((0 == (txIpduRTStatePtr->txDMCntr))
                     &&((ipduPrm->rptNum) > 0))
                    {
                        /* set Ipdu DM counter with configured value. */
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                    }
                }
                else
                {    
                    /* if Ipdu DM counter is equal to zero. */
                    if(0 == (txIpduRTStatePtr->txDMCntr))
                    {
                        /* set Ipdu DM counter with configured value. */
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                    }
                }
                
                /* set Ipdu MDT counter to be configured value. */
                txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                if((ipduPrm->rptNum) > 0)
                {
                    /* DL201406 */
                    /* Set need confirm flag */
                    Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                    /* DL201406 */
                }
                else
                {
                    /* DL201406 */
                    /* Clear need confirm flag because Cfg_N==0 */
                    Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                    /* DL201406 */
                }
            }
        }
        /* under situation of TM==Mix and TM not changed. */
        else if((COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode)) && (FALSE == (ipduPrm->tmChanged)))
        /* DL201419 */
        #else    /* if no filter, tmChanged should always be FALSE */
        if(COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
            /* if this ipdu don't configuration transmit callback 
               function, or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLtInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLtInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLtInd](ipduId, PduInfo.SduDataPtr))) )
            {
                /*   TOC == TriggerOnChange, T == Trigger, P == Pending,     *
                 *   O == need transmit, X == no need transmint,             *
                 *   C == changed, NC = not changed.                         *
                 *    ___________________________                            *
                 *   |___T___|____TOC____|___P___|                           *
                 *   |       |__C__|_NC__|       |                           *
                 *   |       |     |     |       |                           *
                 *   |   O   |     |     |   X   |                           *
                 *   |       |  O  |  X  |       |                           *
                 *   |       |     |     |       |                           *
                 *   |_______|____ |_____|_______|                           *
                 *                                                           *
                 *   According to above truth table, when the value is       *
                 *   'O', Ipdu will be transmitted.                          */
                if(  (TXPROP == COM_TX_PROP_TRIGGERED) 
                  || ( (TXPROP == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                     &&(TRUE == (ipduPrm->signalChanged)) )  )
                {
                    /* Because TM didn't changed, so com should transmit Ipdu 
                       ,and reset N-Times Timer counter, T-Times N and MDT, 
                       in the same time, set DM based on situation. */
                    /* SW201415 */
                    #if (STD_ON == COM_GATEWAY_ENABLE)
                    if(TRUE == isGtwSend)
                    {
                        Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                    }
                    else
                    #endif
                    /* SW201415 */
                    {

                        if(E_OK == PduR_ComTransmit(txIpduPBPtr->comLowLayerPduId, &PduInfo))
                        {
                            /* DL201422 */
                            #if(STD_ON == COM_UPDATEBIT_ENABLE)
                            /* Clear updatebit of this IPdu Signal & SignalGroup */
                            Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                            #endif
                            /* DL201422 */
                         }
                    }

                    /* Set N-Times N and N-Times timer with configured value. */
                    txIpduRTStatePtr->txRmnTimesOfN = ipduPrm->rptNum; 
                    txIpduRTStatePtr->txNTimesPDCntr = ipduPrm->NTimeCntr; 
                    /* if Ipdu DM counter is equal to zero and N-Times N>0. */
                    if( ((ipduPrm->rptNum) > 0)
                      &&(0 == (txIpduRTStatePtr->txDMCntr)) )
                    {
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                    }  
                    /* set Ipdu MDT counter to be configured value. */
                    txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                    if((ipduPrm->rptNum) > 0)
                    {
                        /* DL201406 */
                        /* Set need confirm flag */
                        Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    else
                    {
                        /* DL201406 */
                        /* Clear need confirm flag because Cfg_N==0 */
                        Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                }
            }
        }
        /* under situation of TM==Direct, now TM is ignored. */
        else if( COM_TX_MODE_DIRECT == (ipduPrm->ipduTxMode))
        {
            /* if TM changed, Clear N-Times and N-Counter. */
            if(TRUE == (ipduPrm->tmChanged))
            {
                /* Clear N-Times timer counter and N-Times N counter */
                txIpduRTStatePtr->txRmnTimesOfN = 0; 
                txIpduRTStatePtr->txNTimesPDCntr = 0;
            }

            /* if this ipdu don't configuration transmit callback function,
               or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLtInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLtInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLtInd](ipduId, PduInfo.SduDataPtr))) )
            {
                /*   TOC == TriggerOnChange, T == Trigger, P == Pending,     *
                 *   O == need transmit, X == no need transmint,             *
                 *   C == changed, NC = not changed.                         *
                 *    ___________________________                            *
                 *   |___T___|____TOC____|___P___|                           *
                 *   |       |__C__|_NC__|       |                           *
                 *   |       |     |     |       |                           *
                 *   |   O   |     |     |   X   |                           *
                 *   |       |  O  |  X  |       |                           *
                 *   |       |     |     |       |                           *
                 *   |_______|____ |_____|_______|                           *
                 *                                                           *
                 *   According to above truth table, when the value is       *
                 *   'O', Ipdu will be transmitted.                          */
                if(  (TXPROP == COM_TX_PROP_TRIGGERED) 
                  || ( (TXPROP == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                     &&(TRUE == (ipduPrm->signalChanged)) )  )  
                {
                    /* Regardless of TM changing or not changing, Com 
                       shall transmit Ipdu ,and reset N-Times Timer 
                       counter, T-Times N and MDT, in the same time, 
                       set DM based on situation. */
                     /* SW201415 */
                    #if (STD_ON == COM_GATEWAY_ENABLE)
                    if(TRUE == isGtwSend)
                    {
                        Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                    }
                    else
                    #endif
                    /* SW201415 */
                    {

                        if(E_OK == PduR_ComTransmit(txIpduPBPtr->comLowLayerPduId, &PduInfo))
                        {
                            /* DL201422 */
                            #if(STD_ON == COM_UPDATEBIT_ENABLE)
                            /* Clear updatebit of this IPdu Signal & SignalGroup */
                            Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                            #endif
                            /* DL201422 */
                         }
                    }

			 /* Set N-Times N and N-Times timer with configured value. */
                    txIpduRTStatePtr->txRmnTimesOfN = ipduPrm->rptNum; 
                    txIpduRTStatePtr->txNTimesPDCntr = ipduPrm->NTimeCntr; 

                    /* if N-Timers N>0,
                       Set DM counter with configured value. */
                    if((ipduPrm->rptNum) > 0)
                    {
                        /* set Ipdu DM counter to be configured value. */
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;

                        /* DL201406 */
                        /* Set need confirm flag */
                        Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    } 
                    /* if N-Timers N is equal to zero,
                       Clear DM counter. */
                    else
                    {
                        txIpduRTStatePtr->txDMCntr = 0;

                        /* DL201406 */
                        /* Clear need confirm flag because Cfg_N==0 */
                        Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }

                    /* set Ipdu MDT counter to be configured value. */
                    txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                }   
            }
        }
        else
        {
            /*do nothing*/ 
        }
    }

    /* SW201458 */
    return;

    #undef TXPROP
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/*************************************************************************/
/*
 * Brief               Deal with the MDT, DM, PeriodTimer, N-Times timer, 
 *                     N-Times N of Ipdu to which the signal group belong
 *                     in Com_SendSignalGroup.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant 
 *                     for different signal group.
 * Param-Name[in]      signalGrpId, ipduPrm
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              uint8 E_OK/COM_SERVICE_NOT_AVAILABLE
 * PreCondition        None
 * CallByAPI           Com_IpduHandleInSendSignalGrp
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201458 */
STATIC FUNC(void, COM_CODE)
Com_IpduHandleInSendSignalGrp
(
    Com_SignalGroupIdType signalGrpId, 
    /* SW201415 */
    #if (STD_ON == COM_GATEWAY_ENABLE)
    boolean gtwSend,
    #endif
    /* SW201415 */
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    Com_TxSignalGroupFlagRTType txSigGrpRTFlag = Com_TxSigGrpRTimeFlag[signalGrpId];
    P2CONST(Com_TxSignalGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSigGrpPBPtr = &(COM_PTR_TXSIGGRPPB(signalGrpId));
    PduIdType ipduId = txSigGrpPBPtr->comIPduRefIndex;
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPBPtr = &(COM_PTR_TXIPDUPB(ipduId));
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRTStatePtr = &(Com_TxIPduRTimeState[ipduId]);
    P2VAR(Com_TxIPduFlagRTType, AUTOMATIC, COM_VAR)
    txIpduRTFlagPtr = &(Com_TxIPduRTimeFlag[ipduId]); 
    
    /* MDT wasn't time-out. */
    if(0 != txIpduRTStatePtr->txMDTCntr)
    {        
        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* if TM changed, Set 'COM_RT_TXIPDUFLAG_TMSCHAINMDT' for Com_MainFunctionTx.
           In the same time, handle the N-Times timer counter, N-Times N and PT. */
        if(TRUE == ipduPrm->tmChanged)
        {
            /* DL201413, DL201417 */
            /* Set 'COM_RT_TXIPDUFLAG_TMSCHAINMDT' for Com_MainFunctionTx. */
            Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_TMSCHAINMDT);
            /* DL201417 */

            /* Set 'COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK' for Com_MainFunctionTx. */
            /* TM Changed, only send Pending signalGroup or TriggerOnChange without change
             * in Direct TxMode could not send out IPDU */
            if((COM_TX_MODE_DIRECT != (ipduPrm->ipduTxMode)) || (COM_TX_PROP_TRIGGERED == (Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)))
                || (((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED_ON_CHANGE) && (COM_RT_TXSIGGRP_NEEDNTIMESTX == (Com_GetFlagState(txSigGrpRTFlag, COM_RT_TXSIGGRP_NEEDNTIMESTX)))))
            {
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);

                /* DL201410 */
                /* Clear COM_RT_TXIPDUFLAG_DELAYPENDTX before */
                Com_ClearFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_DELAYPENDTX);
                /* DL201410 */
            }
            /* DL201413 */

            Com_IpduHdlBefMDTForSignalGrp(signalGrpId, ipduPrm);

            /* DL201410 */
            /* TMS Changes to Mixed, and SignalGroup is Pending, set COM_RT_TXIPDUFLAG_DELAYPENDTX,
             * because MainFunction send out IPdu is Periodic component IPdu */
            if((COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
              && ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_PENDING))
            {
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_DELAYPENDTX);
            }
            /* DL201410 */
        }
        else
        /* DL201419, if no filter tmChanged always be FALSE */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
            /*   TOC == TriggerOnChange, T == Trigger, P == Pending,       *
             *   WTP == has Transfer property,                             *
             *   WOTP == has not Transfer property, O == need transmit,    *
             *   X == no need transmint, N == Need Transmit,               *
             *   NN = not Need Transmit.                                   *
             *   Below truth table only valid for Direct and Mix TM.       *
             *    _______________________________________________          *
             *   |____T___|______________TOC____________|___P___|          *
             *   |        |________WTP______|___WOTP____|       |          *
             *   |        |___TOC___|___P___|__C__|_NN__|       |          *
             *   |    O   |_N_|_NN__|       |     |     |   X   |          *
             *   |        |   |     |       |     |     |       |          *
             *   |        | O |  X  |   X   |  O  |  X  |       |          *
             *   |________|___|_____|_______|____ |_____|_______|          *
             *                                                             *
             *   According to above truth table, when the value is 'O', flags       *
             *   'COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK' and                            *
             *   'COM_RT_TXIPDUFLAG_DELAY_MASK' will be set.                        *
             *   N-Times N and N-Times Timer Counter will be set with configured    *
             *   values.                                                            */
            if( ( (COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
                || (COM_TX_MODE_DIRECT == (ipduPrm->ipduTxMode)))
              &&( ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED)
                ||( ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                  &&(COM_RT_TXSIGGRP_NEEDNTIMESTX == (Com_GetFlagState(txSigGrpRTFlag, COM_RT_TXSIGGRP_NEEDNTIMESTX))))))
            {
                Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);
            }
        }
    }
    else
    { 
        PduInfoType PduInfo;
        uint16 lowLayerIpduID = COM_PTR_TXIPDUPB(txSigGrpPBPtr->comIPduRefIndex).comLowLayerPduId;
        Com_TxIPduCOutFuncIndexLTType txIpduCalloutLTInd = Com_TxIPduCalloutLT[ipduId];
        PduInfo.SduLength = COM_CFG_TXIPDU_SIZE(ipduId);
        PduInfo.SduDataPtr = &(Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]);

        /* DL201419 */
        #if (STD_ON == COM_FILTER_ENABLE)
        /* if this ipdu don't configuration transmit callback 
           function, or configured and it return TRUE. */
        if((COM_TX_MODE_PERIODIC == (ipduPrm->ipduTxMode)) 
         &&(TRUE == (ipduPrm->tmChanged)) )
        {   
            /* Clear N-Times N and N-Times Timer Counter*/
            txIpduRTStatePtr->txRmnTimesOfN = 0; 
            txIpduRTStatePtr->txNTimesPDCntr = 0;
            /* Set PT to be configured value. */
            txIpduRTStatePtr->txPDCntr = ipduPrm->PeriodCntr;

            /* if this ipdu don't configuration transmit callback function,
               or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLTInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLTInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLTInd](ipduId, PduInfo.SduDataPtr))) )
            {
                /* SW201415 */
                #if (STD_ON == COM_GATEWAY_ENABLE)
                if(TRUE == gtwSend)
                {
                    Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                }
                else
                #endif
                /* SW201415 */
                {
                    /* call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                    if(E_OK == PduR_ComTransmit(lowLayerIpduID, &PduInfo))
                    { 
                        /* DL201422 */
                        #if(STD_ON == COM_UPDATEBIT_ENABLE)
                        /* Clear updatebit of this IPdu Signal & SignalGroup */
                        Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                        #endif
                        /* DL201422 */
                    }
                }

                /* if Ipdu DM counter is equal to zero. */
                if(0 == (txIpduRTStatePtr->txDMCntr))
                {
                    /* set Ipdu DM counter to be configured value. */
                    txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                }
                /* set Ipdu MDT counter to be configured value. */
                txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                
                /* DL201406 */
                /* Set need confirm flag */
                Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                /* DL201406 */
            }
        }
        /* under situation of TM==Mix and TM changed. */
        else if((COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode)) && (TRUE == (ipduPrm->tmChanged)))
        {
            /* Clear N-Times N and N-Times Timer Counter*/
            txIpduRTStatePtr->txRmnTimesOfN = 0; 
            txIpduRTStatePtr->txNTimesPDCntr = 0;
            /* Set PT to be configured value. */
            txIpduRTStatePtr->txPDCntr = ipduPrm->PeriodCntr;
            
            /* if this ipdu don't configuration transmit callback function,
               or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLTInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLTInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLTInd](ipduId, PduInfo.SduDataPtr))) )
            {
                /* Because TM changed to Mix, so the com should transmit both 
                   N-Times Ipdu and Period Ipdu as well, but here two ipdu was 
                   combined to one Tx Ipdu transmit.
                   call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                /* SW201415 */
                #if (STD_ON == COM_GATEWAY_ENABLE)
                if(TRUE == gtwSend)
                {
                    Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                }
                else
                #endif
                /* SW201415 */
                {
                    /* call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                    if(E_OK == PduR_ComTransmit(lowLayerIpduID, &PduInfo))
                    { 
                        /* DL201422 */
                        #if(STD_ON == COM_UPDATEBIT_ENABLE)
                        /* Clear updatebit of this IPdu Signal & SignalGroup */
                        Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                        #endif
                        /* DL201422 */
                    }
                }


                /*   TOC == TriggerOnChange, T == Trigger, P == Pending,       *
                 *   WTP == has Transfer property,                             *
                 *   WOTP == has not Transfer property, O == need transmit,    *
                 *   X == no need transmint, N == Need Transmit,               *
                 *   NN = not Need Transmit.                                   *
                 *   Below truth table only valid for Direct and Mix TM.       *
                 *    _______________________________________________          *
                 *   |____T___|______________TOC____________|___P___|          *
                 *   |        |________WTP______|___WOTP____|       |          *
                 *   |        |___TOC___|___P___|__C__|_NN__|       |          *
                 *   |    O   |_N_|_NN__|       |     |     |   X   |          *
                 *   |        |   |     |       |     |     |       |          *
                 *   |        | O |  X  |   X   |  O  |  X  |       |          *
                 *   |________|___|_____|_______|____ |_____|_______|          *
                 *                                                             *
                 *   According to above truth table, when the value is         *
                 *   'O', Ipdu's N-Times N and N-Times Timer Counter will      *
                 *   be set with configured value, and the DM counter will     *
                 *   be set to beconfigured value according to situation.      */
                if( ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED) 
                  ||( ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                    &&(COM_RT_TXSIGGRP_NEEDNTIMESTX == (Com_GetFlagState(txSigGrpRTFlag, COM_RT_TXSIGGRP_NEEDNTIMESTX))) ))
                {
                    /* N-Times N and N-Times Timer Counter were set with
                       configured value. */
                    txIpduRTStatePtr->txRmnTimesOfN = ipduPrm->rptNum; 
                    txIpduRTStatePtr->txNTimesPDCntr = ipduPrm->NTimeCntr;
                    /* if Ipdu DM counter is equal to zero and N-Times N>0. */
                    if((0 == (txIpduRTStatePtr->txDMCntr))
                     &&((ipduPrm->rptNum) > 0))
                    {
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                    }
                }
                else
                {
                    /* if Ipdu DM counter is equal to zero. */
                    if(0 == (txIpduRTStatePtr->txDMCntr))
                    {
                        /* set Ipdu DM counter to be configured value. */
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                    }
                }
                
                /* set Ipdu MDT counter to be configured value. */
                txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;

                if((ipduPrm->rptNum) > 0)
                {
                    /* DL201406 */
                    /* Set need confirm flag */
                    Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                    /* DL201406 */
                }
                else
                {
                    /* DL201406 */
                    /* Clear need confirm flag because Cfg_N==0 */
                    Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                    /* DL201406 */
                }
            }
        }
        /* under situation of TM==Mix and TM not changed. */
        else if((COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode)) && (FALSE == (ipduPrm->tmChanged)))
        /* DL201419 */
        #else    /* if no filter, tmChanged always be FALSE */
        if(COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
        /* DL201419 */
        #endif    /* STD_ON == COM_FILTER_ENABLE */
        {
            /* if this ipdu don't configuration transmit callback 
               function, or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLTInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLTInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLTInd](ipduId, PduInfo.SduDataPtr))) )
            {
               /*   TOC == TriggerOnChange, T == Trigger, P == Pending,       *
                *   WTP == has Transfer property,                             *
                *   WOTP == has not Transfer property, O == need transmit,    *
                *   X == no need transmint, N == Need Transmit,               *
                *   NN = not Need Transmit.                                   *
                *   Below truth table only valid for Direct and Mix TM.       *
                *    _______________________________________________          *
                *   |____T___|______________TOC____________|___P___|          *
                *   |        |________WTP______|___WOTP____|       |          *
                *   |        |___TOC___|___P___|__C__|_NN__|       |          *
                *   |    O   |_N_|_NN__|       |     |     |   X   |          *
                *   |        |   |     |       |     |     |       |          *
                *   |        | O |  X  |   X   |  O  |  X  |       |          *
                *   |________|___|_____|_______|____ |_____|_______|          *
                *                                                             *
                *   According to above truth table, when the value is         *
                *   'O', Ipdu will be transmitted.                            */                          
                if(  ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED) 
                  || ( ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                     &&(COM_RT_TXSIGGRP_NEEDNTIMESTX == (Com_GetFlagState(txSigGrpRTFlag, COM_RT_TXSIGGRP_NEEDNTIMESTX))) )  )
                {
                    /* Because TM didn't changed, so com should transmit Ipdu 
                       ,in the same time, reset N-Times Timer counter,  
                       T-Times N and MDT, set DM based on situation. */
                     /* SW201415 */
                    #if (STD_ON == COM_GATEWAY_ENABLE)
                    if(TRUE == gtwSend)
                    {
                        Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                    }
                    else
                    #endif
                    /* SW201415 */
                    {
                        /* call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                        if(E_OK == PduR_ComTransmit(lowLayerIpduID, &PduInfo))
                        { 
                            /* DL201422 */
                            #if(STD_ON == COM_UPDATEBIT_ENABLE)
                            /* Clear updatebit of this IPdu Signal & SignalGroup */
                            Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                            #endif
                            /* DL201422 */
                        }
                    }

                    /* N-Times N and N-Times Timer Counter 
                       were set with configured value. */
                    txIpduRTStatePtr->txRmnTimesOfN = ipduPrm->rptNum; 
                    txIpduRTStatePtr->txNTimesPDCntr = ipduPrm->NTimeCntr; 
                    /* if Ipdu DM counter is equal to zero and N-Times N>0. */
                    if( ((ipduPrm->rptNum) > 0)
                      &&(0 == (txIpduRTStatePtr->txDMCntr)) )
                    {
                        /* set Ipdu DM counter to be configured value. */
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;
                    }    
                    /* set Ipdu MDT counter to be configured value. */
                    txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                    if((ipduPrm->rptNum) > 0)
                    {
                        /* DL201406 */
                        /* Set need confirm flag */
                        Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    else
                    {
                        /* DL201406 */
                        /* Clear need confirm flag because Cfg_N==0 */
                        Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                }
            }
        }
        else if(COM_TX_MODE_DIRECT == (ipduPrm->ipduTxMode))
        {
            /* if TM changed, Clear N-Times and N-Counter. */
            if(TRUE == (ipduPrm->tmChanged))
            {
                /* Clear N-Times timer counter and N-Times N counter */
                txIpduRTStatePtr->txRmnTimesOfN = 0; 
                txIpduRTStatePtr->txNTimesPDCntr = 0;
            }

            /* if this ipdu don't configuration transmit callback 
               function, or configured and it return TRUE. */
            if(  (COM_INDEX_DEFAULT == txIpduCalloutLTInd)
               ||( (COM_INDEX_DEFAULT != txIpduCalloutLTInd)
                 &&(TRUE == IPdu_CalloutFnc[txIpduCalloutLTInd](ipduId, PduInfo.SduDataPtr))) )
            {
               /*   TOC == TriggerOnChange, T == Trigger, P == Pending,       *
                *   WTP == has Transfer property,                             *
                *   WOTP == has not Transfer property, O == need transmit,    *
                *   X == no need transmint, N == Need Transmit,               *
                *   NN = not Need Transmit.                                   *
                *   Below truth table only valid for Direct and Mix TM.       *
                *    _______________________________________________          *
                *   |____T___|______________TOC____________|___P___|          *
                *   |        |________WTP______|___WOTP____|       |          *
                *   |        |___TOC___|___P___|__C__|_NN__|       |          *
                *   |    O   |_N_|_NN__|       |     |     |   X   |          *
                *   |        |   |     |       |     |     |       |          *
                *   |        | O |  X  |   X   |  O  |  X  |       |          *
                *   |________|___|_____|_______|____ |_____|_______|          *
                *                                                             *
                *   According to above truth table, when the value is         *
                *   'O', Ipdu will be transmitted.                            */ 
                if(  ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED) 
                  || ( ((Com_GetFlagState((txSigGrpPBPtr->comSignalGroupPBFlag), COM_PBTXPROP_MASK)) == COM_TX_PROP_TRIGGERED_ON_CHANGE)
                     &&(COM_RT_TXSIGGRP_NEEDNTIMESTX == (Com_GetFlagState(txSigGrpRTFlag, COM_RT_TXSIGGRP_NEEDNTIMESTX))) ) )  
                {
                    /* Regardless of TM changing or not changing, Com 
                       shall transmit Ipdu ,and reset N-Times Timer 
                       counter, T-Times N and MDT, in the same time, 
                       set DM based on situation. */
                     #if (STD_ON == COM_GATEWAY_ENABLE)
                    if(TRUE == gtwSend)
                    {
                        Com_SetFlagState((*txIpduRTFlagPtr), COM_RT_TXIPDUFLAG_GWNEEDTX_MASK);  
                    }
                    else
                    #endif
                    /* SW201415 */
                    {
                        /* call PduR_ComTransmit API from PDUR module, and it return E_OK. */
                        if(E_OK == PduR_ComTransmit(lowLayerIpduID, &PduInfo))
                        { 
                            /* DL201422 */
                            #if(STD_ON == COM_UPDATEBIT_ENABLE)
                            /* Clear updatebit of this IPdu Signal & SignalGroup */
                            Com_ClearUpdatesInTxIPduMF(txIpduPBPtr)
                            #endif
                            /* DL201422 */
                        }
                    }

                    /* N-Times N and N-Times Timer Counter 
                       were set with configured value. */
                    txIpduRTStatePtr->txRmnTimesOfN = ipduPrm->rptNum; 
                    txIpduRTStatePtr->txNTimesPDCntr = ipduPrm->NTimeCntr;
                    
                    /* if Ipdu DM counter is equal to zero. */
                    if((ipduPrm->rptNum) > 0)
                    {
                        /* set Ipdu DM counter to be configured value. */
                        txIpduRTStatePtr->txDMCntr = txIpduPBPtr->comIPduDM;

                        /* DL201406 */
                        /* Set need confirm flag */
                        Com_SetFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    } 
                    else
                    {
                        /* Clear DM counter */
                        txIpduRTStatePtr->txDMCntr = 0;

                        /* DL201406 */
                        /* Clear need confirm flag because Cfg_N==0 */
                        Com_ClearFlagState((*txIpduRTFlagPtr),COM_RT_TXIPDUFLAG_NOCONFIRMED_MASK);
                        /* DL201406 */
                    }
                    /* set Ipdu MDT counter to be configured value. */
                    txIpduRTStatePtr->txMDTCntr = txIpduPBPtr->comIPduMDT;
                }   
            } 
        } 
        else
        {
            /*do nothing*/ 
        }
    }

    /* Clear signal group needing N-Times flag. */
    Com_ClearFlagState(Com_TxSigGrpRTimeFlag[signalGrpId], COM_RT_TXSIGGRP_NEEDNTIMESTX);

    /* SW201458 */
    return;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"

/* DL201419, this function is only used in TMS changed, so no filter, no this function */
#if (STD_ON == COM_FILTER_ENABLE)
/*************************************************************************/
/*
 * Brief               handle period counter and N-Times Number and N-Times
 *                     counter when MDT didn't timeout and TM changed inside
 *                     Com_SendSignal.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal, reentrant for 
 *                     different signal.
 * Param-Name[in]      signalId, ipduPrm
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_IpduHdlBefMDTForSignal
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_IpduHdlBefMDTForSignal
(
    /* SW201416 */
    PduIdType ipduId, 
    uint8 txPbFlag,
    /* SW201416 */
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define TXPROP Com_GetFlagState(txPbFlag, COM_PBTXPROP_MASK)

    /* DL201413, DL201414 */
    /* if TM is Perodic or Mix. */
    /*if(  (COM_TX_MODE_PERIODIC == (ipduPrm->ipduTxMode))
       ||(COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode)))
    {*/
        /* Set flag of 'COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK'
           and 'COM_RT_TXIPDUFLAG_DELAY_MASK'. */
        /*Com_SetFlagState((Com_TxIPduRTimeFlag[IPDUID]), COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);*/
        /* DL201409 */
        /* Com_SetFlagState((Com_TxIPduRTimeFlag[IPDUID]), COM_RT_TXIPDUFLAG_DELAY_MASK); */
        /* DL201409 */
        /* Set PT counter with configured value. */
        /*Com_TxIPduRTimeState[IPDUID].txPDCntr = ipduPrm->PeriodCntr;
    }*/
    /* DL201413, DL201414 */

    /*   TOC == TriggerOnChange, T == Trigger, P == Pending,     *
     *   O == need transmit, X == no need transmint,             *
     *   C == changed, NC = not changed.                         *
     *    ___________________________                            *
     *   |___T___|____TOC____|___P___|                           *
     *   |       |__C__|_NC__|       |                           *
     *   |       |     |     |       |                           *
     *   |   O   |     |     |   X   |                           *
     *   |       |  O  |  X  |       |                           *
     *   |       |     |     |       |                           *
     *   |_______|____ |_____|_______|                           *
     *                                                           *
     *   According to above truth table, when the value is       *
     *   'O', N-Timers N counter and N-Timers Timer counter      *
     *   will be cleared.                                        */
    if( (COM_TX_MODE_PERIODIC == (ipduPrm->ipduTxMode)) 
       ||( ( (COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
            ||(COM_TX_MODE_DIRECT == (ipduPrm->ipduTxMode)) )
         &&( (TXPROP == COM_TX_PROP_TRIGGERED)
           ||( (TXPROP == COM_TX_PROP_TRIGGERED_ON_CHANGE)
             &&(FALSE == ipduPrm->signalChanged)))))
    {
        /* Clear N-Timers N counter 
           and N-Timers Timer counter. */
        /* SW201416 */
        Com_TxIPduRTimeState[ipduId].txRmnTimesOfN = 0; 
        Com_TxIPduRTimeState[ipduId].txNTimesPDCntr = 0;
        /* SW201416 */
    }

    return ;

    #undef TXPROP
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* DL201419 */
#endif    /* STD_ON == COM_FILTER_ENABLE */


/* DL201419, this function is only used in TMS changed, so no filter, no this function */
#if (STD_ON == COM_FILTER_ENABLE)
/*************************************************************************/
/*
 * Brief               handle period counter and N-Times Number and N-Times
 *                     counter when MDT didn't timeout and TM changed inside
 *                     Com_SendSignalGroup.
 * ServiceId           None
 * Sync/Async          Synchronous
 * Reentrancy          Non Reentrant for the same signal group, reentrant 
 *                     for different signal group.
 * Param-Name[in]      signalGrpId, ipduPrm
 * Param-Name[out]     None
 * Param-Name[in/out]  None
 * Return              None
 * PreCondition        None
 * CallByAPI           Com_IpduHdlBefMDTForSignalGrp
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_IpduHdlBefMDTForSignalGrp
(
    Com_SignalGroupIdType signalGrpId, 
    P2CONST(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define IPDUID COM_CFG_TXSIGNALGROUP_IPDUIDREF(signalGrpId)
    #define TXPROP Com_GetFlagState(COM_CFG_TXSIGNALGROUP_PBFLAG(signalGrpId), COM_PBTXPROP_MASK)
    #define NEEDNTIME Com_GetFlagState((Com_TxSigGrpRTimeFlag[signalGrpId]), COM_RT_TXSIGGRP_NEEDNTIMESTX)

    /* DL201413, DL201414 */
    /* if TM is Perodic or Mix. */
    /* if(  (COM_TX_MODE_PERIODIC == (ipduPrm->ipduTxMode))
       ||(COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode)))
    {*/
        /* Set flag of 'COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK'
           and 'COM_RT_TXIPDUFLAG_DELAY_MASK'. */
        /* Com_SetFlagState((Com_TxIPduRTimeFlag[IPDUID]), COM_RT_TXIPDUFLAG_FIRSTDELAY_MASK);*/
        /* DL201409 */
        /* Com_SetFlagState((Com_TxIPduRTimeFlag[IPDUID]), COM_RT_TXIPDUFLAG_DELAY_MASK); */
        /* DL201409 */
        /* Set PT counter with configured value. */
    /*    Com_TxIPduRTimeState[IPDUID].txPDCntr = ipduPrm->PeriodCntr;
    }*/
    /* DL201413, DL201414 */

    /*   TOC == TriggerOnChange, T == Trigger, P == Pending,       *
     *   WTP == has Transfer property,                             *
     *   WOTP == has not Transfer property, O == need transmit,    *
     *   X == no need transmint, N == Need Transmit,               *
     *   NN = not Need Transmit.                                   *
     *   Below truth table only valid for Direct and Mix TM.       *
     *    _______________________________________________          *
     *   |____T___|______________TOC____________|___P___|          *
     *   |        |________WTP______|___WOTP____|       |          *
     *   |        |___TOC___|___P___|__C__|_NN__|       |          *
     *   |    O   |_N_|_NN__|       |     |     |   X   |          *
     *   |        |   |     |       |     |     |       |          *
     *   |        | O |  X  |   X   |  O  |  X  |       |          *
     *   |________|___|_____|_______|____ |_____|_______|          *
     *                                                             *
     *   According to above truth table, when the value is         *
     *   'O', N-Timers N counter and N-Timers Timer counter        *
     *   will be cleared.                                          */
    if( (COM_TX_MODE_PERIODIC == (ipduPrm->ipduTxMode)) 
       ||( ( (COM_TX_MODE_MIXED == (ipduPrm->ipduTxMode))
            ||(COM_TX_MODE_DIRECT == (ipduPrm->ipduTxMode)) )
         &&( (TXPROP == COM_TX_PROP_TRIGGERED)
           ||( (TXPROP == COM_TX_PROP_TRIGGERED_ON_CHANGE)
             &&(COM_RT_TXSIGGRP_NEEDNTIMESTX != NEEDNTIME)))))
    {
        /* Clear N-Timers N counter 
           and N-Timers Timer counter. */
        Com_TxIPduRTimeState[IPDUID].txRmnTimesOfN = 0; 
        Com_TxIPduRTimeState[IPDUID].txNTimesPDCntr = 0;
    }

    return ;
    
    #undef IPDUID
    #undef TXPROP
    #undef NEEDNTIME
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
/* DL201419 */
#endif

/* SW201459 */
/* SW201419 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                        gateway handling uint8N description sending with descrition source.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalMapId, destObjId, ipduPrm
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GtwDescToDesc8NDirectCopy
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GtwDescToDesc8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define GWYDESTDESCID (0x7fff & COM_CFG_DEST_ID(destObjId))
    #define GWYSRCDESCID (0x7fff & (COM_PTR_GWSIGNALMAP(signalMapId).comGwSrcIndex))

    uint8 copyCnt;
    uint16 signal8NSize;
    
    P2CONST(Com_GwDestDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    destDescPbPtr = &(COM_PTR_GWDESTDESCPB(GWYDESTDESCID));
    P2CONST(Com_GwSourceDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    srcDescPbPtr = &(COM_PTR_GWSRCDESCPB(GWYSRCDESCID));
    uint16 gwyDestDescIpduBuffIndex =  destDescPbPtr->comGwDestLSBPos + 
		COM_PTR_TXIPDUPB(destDescPbPtr->comGwDestIPduRefIndex).comTxIPduBufIndex;
    uint16 gwySrcDescIpduBuffIndex =  srcDescPbPtr->comGwSrcLSBPos + 
		COM_PTR_RXIPDUPB(srcDescPbPtr->comGwSrcIPduRefIndex).comRxIPduBufIndex;

    /* calculate byte size through the destination description MSB position and LSB position. */
    if(destDescPbPtr->comGwDestMSBPos>destDescPbPtr->comGwDestLSBPos)                                                                                          
    {                                                                                                                                                                   
        signal8NSize = destDescPbPtr->comGwDestMSBPos - destDescPbPtr->comGwDestLSBPos;                                                                    
    }                                                                                                                                                                   
    else                                                                                                                                                               
    {                                                                                                                                                                   
        signal8NSize = destDescPbPtr->comGwDestLSBPos - destDescPbPtr->comGwDestMSBPos;                                                                    
    } 

    /* if source description endiness is the same as destination description */
    if( Com_GetFlagState(srcDescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK)                
    == Com_GetFlagState(destDescPbPtr->comGwDestFlag, COM_PBTXSIGENDIANESS_MASK))           
    {    
        /* SW201460 */
        /* if the endiness is big. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                  
        == Com_GetFlagState(srcDescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK))           
        {        
            uint16 destDesc8nLimit = gwyDestDescIpduBuffIndex - signal8NSize;
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(; gwyDestDescIpduBuffIndex >= destDesc8nLimit; gwyDestDescIpduBuffIndex--)                                                                                       
            {       
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex]                                                    
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex])                                                    
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex] =                                                 
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex];                                                    
                }  
                gwySrcDescIpduBuffIndex--;
            }                                                                                                                                                            
        }                                                                                                                                                                
        else                                                                                                                                                            
        { 
            uint16 destDesc8nLimit = gwyDestDescIpduBuffIndex + signal8NSize;
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(; gwyDestDescIpduBuffIndex <= destDesc8nLimit; gwyDestDescIpduBuffIndex++)                                                                                       
            {     
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex]
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex])                                                    
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex] =                                                 
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex];                                                    
                }
                gwySrcDescIpduBuffIndex++;
            }                                                                                                                                                            
        }    
        /* SW201460 */
    }                                                                                                                                                                    
    else                                                                                                                                                                
    {          
        /* if the source is big, and destination is little. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                   
        == Com_GetFlagState(srcDescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK) )           
        { 
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                             
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex + copyCnt]                                                     
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex - copyCnt])                                                     
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex + copyCnt] =                                                  
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex -copyCnt];                                                      
                }                                                                                                                                                         
            }                                                                                                                                                             
        }                                                                                                                                                                 
        else if( COM_RXSIGNAL_ENDIANESS_LITTLE                                                                                                        
             ==  Com_GetFlagState(srcDescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK))      
        {       
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                             
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex - copyCnt]                                                     
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex + copyCnt])                                                     
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex - copyCnt] =                                                   
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex + copyCnt];                                                      
                }                                                                                                                                                          
            }                                                                                                                                                              
        }                                                                                                                                                                  
        else                                                                                                                                                              
        {                                                                                                                                                                   
            /* if source description is opaque, then the destination description must be opaque,  */                                           
            /* otherwiseit can be judge as tool bug or configuration error. */                                                                         
        }                                                                                                                                                                   
    }

    return ;

    #undef GWYDESTDESCID
    #undef GWYSRCDESCID
}
#endif
/* SW201419 */
/* SW201459 */

/* SW201420 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                       gateway handling uint8N signal sending with descrition source.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalMapId, destObjId, ipduPrm
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GtwDescToSignal8NDirectCopy
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201459 */
STATIC FUNC(void, COM_CODE)
Com_GtwDescToSignal8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define GWYSRCDESCID 0x7fff&COM_CFG_SIGGWMAP_SRCID(signalMapId)

    uint8 copyCnt;
    uint16 signal8NSize; 

    P2CONST(Com_GwSourceDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    srcSescPbPtr = &(COM_PTR_GWSRCDESCPB(GWYSRCDESCID));
    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSignalPbPtr = &(COM_PTR_TXSIGNALPB(COM_CFG_DEST_ID(destObjId)));
    uint16 gwySrcDescIpduBuffIndex = srcSescPbPtr->comGwSrcLSBPos + 
               COM_PTR_RXIPDUPB(srcSescPbPtr->comGwSrcIPduRefIndex).comRxIPduBufIndex;
    uint16 gwyDestSignalIpduBuffIndex = txSignalPbPtr->comSignalLSBPos +
	         COM_PTR_TXIPDUPB(txSignalPbPtr->comIPduRefIndex).comTxIPduBufIndex;

    /* calculate byte size through the destination signal MSB position and LSB position. */
    if(txSignalPbPtr->comSignalMSBPos>txSignalPbPtr->comSignalLSBPos)                                                                                     
    {                                                                                                                                                                   
        signal8NSize = txSignalPbPtr->comSignalMSBPos - txSignalPbPtr->comSignalLSBPos;                                                               
    }                                                                                                                                                                   
    else                                                                                                                                                               
    {                                                                                                                                                                   
        signal8NSize = txSignalPbPtr->comSignalLSBPos - txSignalPbPtr->comSignalMSBPos;                                                               
    }   

    /* if source description endiness is the same as destination signal */
    if( Com_GetFlagState(srcSescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK)                
    == Com_GetFlagState(txSignalPbPtr->comSignalPBFlag, COM_PBTXSIGENDIANESS_MASK))      
    {        
        /* SW201460 */
        /* if the endiness is big. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                  
        == Com_GetFlagState(srcSescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK))           
        {                     
            uint16 destSignal8nLimit = gwyDestSignalIpduBuffIndex - signal8NSize;
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(; gwyDestSignalIpduBuffIndex >= destSignal8nLimit; gwyDestSignalIpduBuffIndex--)                                                                                       
            {      
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex]                                                  
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex])                                                    
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex] =                                               
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex];                                                    
                }    
                gwySrcDescIpduBuffIndex--;
            }                                                                                                                                                            
        }                                                                                                                                                                
        else                                                                                                                                                            
        {   
            uint16 destSignal8nLimit = gwyDestSignalIpduBuffIndex + signal8NSize;
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; gwyDestSignalIpduBuffIndex <= destSignal8nLimit; gwyDestSignalIpduBuffIndex++)                                                                                       
            {    
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex]                                                  
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex])                                                    
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex] =                                               
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex];                                                   
                } 
                gwySrcDescIpduBuffIndex++;
            }                                                                                                                                                            
        }  
        /* SW201460 */
    }                                                                                                                                                                    
    else                                                                                                                                                                
    {        
        /* if the source is big, and destination is little. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                   
        == Com_GetFlagState(srcSescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK) )           
        {              
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                             
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex + copyCnt]                                                  
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex - copyCnt])                                                     
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex + copyCnt] =                                                
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex -copyCnt];                                                      
                }                                                                                                                                                         
            }                                                                                                                                                             
        }                                                                                                                                                                 
        else if( COM_RXSIGNAL_ENDIANESS_LITTLE                                                                                                        
             ==  Com_GetFlagState(srcSescPbPtr->comGwSrcFlag, COM_PBRXSIGENDIANESS_MASK))      
        {    
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                             
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex - copyCnt]                                                   
                != Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex + copyCnt])                                                     
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex - copyCnt] =                                                
                    Com_RxIPduRuntimeBuff[gwySrcDescIpduBuffIndex + copyCnt];                                                      
                }                                                                                                                                                          
            }                                                                                                                                                              
        }                                                                                                                                                                  
        else                                                                                                                                                              
        {                                                                                                                                                                   
            /* if source description is opaque, then the destination description must be opaque,  */                                           
            /* otherwiseit can be judge as tool bug or configuration error. */                                                                         
        }                                                                                                                                                                   
    }

    return;
    #undef GWYSRCDESCID
}
#endif
/* SW201459 */
/* SW201420 */

/* SW201421 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                       gateway handling uint8N description sending with signal source.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalMapId, destObjId, ipduPrm
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GtwSignalToDesc8NDirectCopy
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201459 */
STATIC FUNC(void, COM_CODE)
Com_GtwSignalToDesc8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define GWY_SRC_SIGNALID (COM_PTR_GWSIGNALMAP(signalMapId).comGwSrcIndex)
    #define GWY_DEST_DESCID (0x7fff & (COM_CFG_DEST_ID(destObjId))) 

    uint8 copyCnt;
    uint16 signal8NSize;

    P2CONST(Com_GwDestDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    destDescPbPtr = &(COM_PTR_GWDESTDESCPB(GWY_DEST_DESCID));
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(GWY_SRC_SIGNALID));
    uint16 gwyDestDescIpduBuffIndex = destDescPbPtr->comGwDestLSBPos + 
               COM_CFG_TXIPDU_BUFFINDEX(destDescPbPtr->comGwDestIPduRefIndex);
    uint16 gwySrcSignalIpduBuffIndex = rxSignalPbPtr->comSignalLSBPos +
	         COM_CFG_RXIPDU_BUFFINDEX(rxSignalPbPtr->comIPduRefIndex);

    /* calculate byte size through the destination description MSB position and LSB position. */
    if(destDescPbPtr->comGwDestMSBPos > destDescPbPtr->comGwDestLSBPos)                                                                                          
    {                                                                                                                                                                   
        signal8NSize = destDescPbPtr->comGwDestMSBPos - destDescPbPtr->comGwDestLSBPos;                                                                    
    }                                                                                                                                                                   
    else                                                                                                                                                               
    {                                                                                                                                                                   
        signal8NSize = destDescPbPtr->comGwDestLSBPos - destDescPbPtr->comGwDestMSBPos;                                                                    
    }  

    /* if source signal endiness is the same as destination description */
    if( Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK)             
    == Com_GetFlagState(COM_PTR_TXSIGNALPB(GWY_DEST_DESCID).comSignalPBFlag, COM_PBTXSIGENDIANESS_MASK))            
    {       
        /* SW201460 */
        /* if the endiness is big. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                  
        == Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK))        
        {
            uint16 destDesc8nLimit = gwyDestDescIpduBuffIndex - signal8NSize;
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(; gwyDestDescIpduBuffIndex >= destDesc8nLimit; gwyDestDescIpduBuffIndex--)                                                                                       
            {                                                                                                                                                            
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex]                                                   
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex])                                                 
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex] =                                                 
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex];                                                  
                } 
                gwySrcSignalIpduBuffIndex--;
            }                                                                                                                                                            
        }                                                                                                                                                                
        else                                                                                                                                                            
        {           
            uint16 destDesc8nLimit = gwyDestDescIpduBuffIndex + signal8NSize;
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; gwyDestDescIpduBuffIndex <= destDesc8nLimit; gwyDestDescIpduBuffIndex++)                                                                                       
            {                                                                                                                                                            
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex]                                                    
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex])                                                 
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex] =                                                 
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex];                                                  
                } 
		   gwySrcSignalIpduBuffIndex++;
            }                                                                                                                                                            
        } 
        /* SW201460 */
    }                                                                                                                                                                    
    else                                                                                                                                                                
    {        
        /* if the source is big, and destination is little. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                   
        == Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK) )        
        {         
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                             
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex + copyCnt]                                                     
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex - copyCnt])                                                  
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex + copyCnt] =                                                  
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex -copyCnt];                                                    
                }                                                                                                                                                         
            }                                                                                                                                                             
        }                                                                                                                                                                 
        else if( COM_RXSIGNAL_ENDIANESS_LITTLE                                                                                                        
             ==  Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK))   
        {    
            /* directly copy this description value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                              
                if( Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex - copyCnt]                                                      
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex + copyCnt])                                                   
                {                                                                                                                                                          
                    ipduPrm->signalChanged = TRUE;                                                                                                              
                    Com_TxIPduRuntimeBuff[gwyDestDescIpduBuffIndex - copyCnt] =                                                 
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex + copyCnt];                                                    
                }                                                                                                                                                          
            }                                                                                                                                                              
        }                                                                                                                                                                  
        else                                                                                                                                                              
        {                                                                                                                                                                   
            /* if source description is opaque, then the destination description must be opaque,  */                                           
            /* otherwiseit can be judge as tool bug or configuration error. */                                                                         
        }                                                                                                                                                                   
    }

	return;
	
    #undef GWY_SRC_SIGNALID
    #undef GWY_DEST_DESCID
}
#endif
/* SW201459 */
/* SW201421 */

/* SW201422 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                       gateway handling uint8N signal sending with signal source.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalMapId, destObjId, ipduPrm
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GtwSignalToSignal8NDirectCopy
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201459 */
STATIC FUNC(void, COM_CODE)
Com_GtwSignalToSignal8NDirectCopy
(
    uint16 signalMapId,
    uint16 destObjId,
    P2VAR(IpduHandlePrmType, AUTOMATIC, COM_APPL_DATA) ipduPrm
)
{
    #define GWY_SRC_SIGNALID (COM_CFG_SIGGWMAP_SRCID(signalMapId))
    #define GWY_DEST_SIGORGRPID (COM_CFG_DEST_ID(destObjId))

    uint8 copyCnt;
    uint16 signal8NSize;
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSignalPbPtr = &(COM_PTR_RXSIGNALPB(GWY_SRC_SIGNALID));
    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    tsSignalPbPtr = &(COM_PTR_TXSIGNALPB(GWY_DEST_SIGORGRPID));
    uint16 gwyDestSignalIpduBuffIndex = tsSignalPbPtr->comSignalLSBPos + 
               COM_CFG_TXIPDU_BUFFINDEX(tsSignalPbPtr->comIPduRefIndex);
    uint16 gwySrcSignalIpduBuffIndex = rxSignalPbPtr->comSignalLSBPos +
	         COM_CFG_RXIPDU_BUFFINDEX(rxSignalPbPtr->comIPduRefIndex);

    /* calculate byte size through the destination signal MSB position and LSB position. */
    if(tsSignalPbPtr->comSignalMSBPos > tsSignalPbPtr->comSignalLSBPos)                                                                                     
    {                                                                                                                                                                   
        signal8NSize = tsSignalPbPtr->comSignalMSBPos - tsSignalPbPtr->comSignalLSBPos;                                                               
    }                                                                                                                                                                   
    else                                                                                                                                                               
    {                                                                                                                                                                   
        signal8NSize = tsSignalPbPtr->comSignalLSBPos - tsSignalPbPtr->comSignalMSBPos;                                                               
    }        

    /* if source signal endiness is the same as destination signal */
    if( Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK)             
    == Com_GetFlagState(tsSignalPbPtr->comSignalPBFlag, COM_PBTXSIGENDIANESS_MASK))      
    {    
        /* SW201460 */
        /* if the endiness is big. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                  
        == Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK))        
        {           
            uint16 destSignal8nLimit = gwyDestSignalIpduBuffIndex - signal8NSize;
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(; gwyDestSignalIpduBuffIndex >= destSignal8nLimit; gwyDestSignalIpduBuffIndex--)                                                                                       
            {                                                                                                                                                            
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex]                                                  
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex])                                                 
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex] =                                               
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex];                                                  
                }   
		   gwySrcSignalIpduBuffIndex--;
            }                                                                                                                                                            
        }                                                                                                                                                                
        else                                                                                                                                                            
        {         
            uint16 destSignal8nLimit = gwyDestSignalIpduBuffIndex + signal8NSize;
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(; gwyDestSignalIpduBuffIndex <= destSignal8nLimit; gwyDestSignalIpduBuffIndex++)                                                                                       
            {                                                                                                                                                            
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex]                                                  
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex])                                                 
                {                                                                                                                                                        
                    ipduPrm->signalChanged = TRUE;                                                                                                            
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex] =                                               
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex];                                                  
                }  
                gwySrcSignalIpduBuffIndex++;
            }                                                                                                                                                            
        }      
        /* SW201460 */
    }                                                                                                                                                                    
    else                                                                                                                                                                
    {                  
        /* if the source is big, and destination is little. */
        if( COM_RXSIGNAL_ENDIANESS_BIG                                                                                                                   
        == Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK) )        
        {         
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                             
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex + copyCnt]                                                  
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex - copyCnt])                                                  
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex + copyCnt] =                                               
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex -copyCnt];                                                    
                }                                                                                                                                                         
            }                                                                                                                                                             
        }                                                                                                                                                                 
        else if( COM_RXSIGNAL_ENDIANESS_LITTLE                                                                                                        
             ==  Com_GetFlagState(rxSignalPbPtr->comSignalPBFlag, COM_PBRXSIGENDIANESS_MASK))    
        {   
            /* directly copy this signal value from tx ipdu buffer to rx ipdu buffer.  */
            for(copyCnt = 0; copyCnt <= signal8NSize; copyCnt++)                                                                                        
            {                                                                                                                                                            
                if( Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex - copyCnt]                                                   
                != Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex + copyCnt])                                                  
                {                                                                                                                                                         
                    ipduPrm->signalChanged = TRUE;                                                                                                             
                    Com_TxIPduRuntimeBuff[gwyDestSignalIpduBuffIndex - copyCnt] =                                                
                    Com_RxIPduRuntimeBuff[gwySrcSignalIpduBuffIndex + copyCnt];                                                   
                }                                                                                                                                                          
            }                                                                                                                                                              
        }                                                                                                                                                                  
        else                                                                                                                                                              
        {                                                                                                                                                                   
            /* if source description is opaque, then the destination description must be opaque,  */                                           
            /* otherwiseit can be judge as tool bug or configuration error. */                                                                         
        }                                                                                                                                                                   
    }

	return;

    #undef GWY_SRC_SIGNALID
    #undef GWY_DEST_SIGORGRPID
}
#endif
/* SW201459 */
/* SW201422 */

/* SW201425 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                        handle Signal sending with descrition or signal source.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalMapId, destObjId, isFromDesc
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GwySignalSendHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalSendHandle
(
    uint16 signalMapId,
    uint16 destObjId,
    boolean isFromDesc,
    uint32 unpackRslt
)
{
    Com_SignalIdType destSigOrGrpId = COM_CFG_DEST_ID(destObjId);
    IpduHandlePrmType ipduPrm;
    P2CONST(Com_TxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSignalPBPtr = &(COM_PTR_TXSIGNALPB(destSigOrGrpId));
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPBPtr = &(COM_PTR_TXIPDUPB(txSignalPBPtr->comIPduRefIndex));

    /* if the filter macro was switch off, the TM parameter will be set with true value. */
    ipduPrm.ipduTxMode = COM_CFG_TXMODE_IND_TRUE(txIpduPBPtr->comTxModeTrueIndex);                          
    ipduPrm.rptNum = COM_CFG_TXMODE_IND_TRUE_N(txIpduPBPtr->comTxModeTrueIndex);                     
    ipduPrm.PeriodCntr = COM_CFG_TXMODE_IND_TRUE_PERIODCNTR(txIpduPBPtr->comTxModeTrueIndex);      
    ipduPrm.NTimeCntr = COM_CFG_TXMODE_IND_TRUE_NTCNTR(txIpduPBPtr->comTxModeTrueIndex);  
    ipduPrm.signalChanged = FALSE;
    ipduPrm.tmChanged = FALSE;

    #if (STD_ON == COM_FILTER_ENABLE)
    /* if the signal has been configured filter, do TMS */
    if(COM_INDEX_DEFAULT != (txSignalPBPtr->comFilterFuncIndex))
    {
        /* return whether tm changed, after TMS. */
        ipduPrm.tmChanged = Com_TxSignalTMSHandle(destSigOrGrpId, (void*)(&unpackRslt));
    }
	
    /* according to TMS result, getting TM, N-Times N, N-Times timer, PT. */
    if(0u == (Com_TxIPduRTimeState[txSignalPBPtr->comIPduRefIndex].txTMSCntr))
    {/* TMS==FALSE */
         ipduPrm.ipduTxMode = COM_CFG_TXMODE_IND_FALSE(txIpduPBPtr->comTxModeFalseIndex);
         ipduPrm.rptNum = COM_CFG_TXMODE_IND_FALSE_N(txIpduPBPtr->comTxModeFalseIndex);
         ipduPrm.PeriodCntr = COM_CFG_TXMODE_IND_FALSE_PERIODCNTR(txIpduPBPtr->comTxModeFalseIndex);
         ipduPrm.NTimeCntr = COM_CFG_TXMODE_IND_FALSE_NTCNTR(txIpduPBPtr->comTxModeFalseIndex);
    }
    #endif 

    /* if the destination signal type is uint8n. */
    if( COM_TXSINGAL_TYPE_UNIT8_N 
    == (Com_GetFlagState(txSignalPBPtr->comSignalPBFlag, COM_PBTXSIGNALTYPE_MASK)) )
    {
        /* if the source is description. */
        if(TRUE == isFromDesc)
        {
            /* copy value from description to signal. */
            Com_GtwDescToSignal8NDirectCopy(signalMapId, destObjId, &ipduPrm);
        }
        else
        {
            /* copy value from signal to signal. */
            Com_GtwSignalToSignal8NDirectCopy(signalMapId, destObjId, &ipduPrm);
        }
    }
    else
    {
        Com_TxSetSignalBuff( txSignalPBPtr, &unpackRslt, ipduPrm.signalChanged)

        /* if the signal changed. */
        if(TRUE == ipduPrm.signalChanged)
        {
             /* pack the result into ipdu Tx buffer. */
              Com_TxPack(txSignalPBPtr->comSignalPBFlag, txSignalPBPtr->comSignalLSBPos, txSignalPBPtr->comSignalMSBPos, 
              (void*)(&unpackRslt), &Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]);
        }
    }

    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    /* if the destination signal has updatebit. */
    if(COM_INDEX_DEFAULT != txSignalPBPtr->comSignalUpdateBitPos)
    {
        Com_HandleSignalUpdateBit(destSigOrGrpId, ipduPrm.ipduTxMode, ipduPrm.rptNum)
    }
    #endif
		
    /* if the ipdu group is active, the ipdu including the sending signal will be dealed with*/
    if(Com_GetFlagState( Com_TxIPduRTimeFlag[txSignalPBPtr->comIPduRefIndex], 
                                     COM_RT_TXIPDUFLAG_ACTIVE_MASK) > 0u)
    {
        /* If the TM changed, the DM counter will be cleared first. 
        Then the DM, MDT, N-Times N, N-Times Timer counter, PT will
        be set under practical situations. */
        if(TRUE == ipduPrm.tmChanged)
        {
            Com_TxIPduRTimeState[txSignalPBPtr->comIPduRefIndex].txDMCntr = 0u;
        }
        
        if(ipduPrm.ipduTxMode != COM_TX_MODE_NONE)
        { 
            /* mark:SW201437 */
            (void)Com_IpduHandleInSendSignal(destSigOrGrpId, FALSE, TRUE, &ipduPrm);
            /* mark:SW201437 */
        } 
        else
        {
            /* if TM == NONE, clear all Timer counters except for MDT. */
            Com_TxIPduRTimeState[txSignalPBPtr->comIPduRefIndex].txRmnTimesOfN = 0u;
            Com_TxIPduRTimeState[txSignalPBPtr->comIPduRefIndex].txNTimesPDCntr = 0u;
            Com_TxIPduRTimeState[txSignalPBPtr->comIPduRefIndex].txPDCntr = 0u;
            Com_TxIPduRTimeState[txSignalPBPtr->comIPduRefIndex].txDMCntr = 0u;
        }
    }

	return;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_GATEWAY_ENABLE */
/* SW201425 */

/* SW201424 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                        handle description sending with descrition or signal source.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalMapId, destObjId, isFromDesc, unpackRslt
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GwyDescSendHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
/* SW201459 */
STATIC FUNC(void, COM_CODE)
Com_GwyDescSendHandle
(
    uint16 signalMapId,
    uint16 destObjId,
    boolean isFromDesc,
    uint32 unpackRslt
)
{
    IpduHandlePrmType ipduPrm;
    uint16 gwyDestDescId = 0x7fff & (COM_CFG_DEST_ID(destObjId));
    P2CONST(Com_GwDestDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    destDescPBTypePtr = &(COM_PTR_GWDESTDESCPB(gwyDestDescId));
    P2CONST(Com_TxIPduPBType, AUTOMATIC, COM_CONST_PBCFG)
    txIpduPBPtr = &(COM_PTR_TXIPDUPB(destDescPBTypePtr->comGwDestIPduRefIndex));

    /* if the filter macro was switch off, the TM parameter will be set with true value. */
    ipduPrm.ipduTxMode = COM_CFG_TXMODE_IND_TRUE(txIpduPBPtr->comTxModeTrueIndex);                          
    ipduPrm.rptNum = COM_CFG_TXMODE_IND_TRUE_N(txIpduPBPtr->comTxModeTrueIndex);                     
    ipduPrm.PeriodCntr = COM_CFG_TXMODE_IND_TRUE_PERIODCNTR(txIpduPBPtr->comTxModeTrueIndex);      
    ipduPrm.NTimeCntr = COM_CFG_TXMODE_IND_TRUE_NTCNTR(txIpduPBPtr->comTxModeTrueIndex);  
    ipduPrm.signalChanged = FALSE;
    ipduPrm.tmChanged = FALSE;
	
    #if (STD_ON == COM_FILTER_ENABLE)
    /* if the description has been configured filter, do TMS */
    if(COM_INDEX_DEFAULT != (destDescPBTypePtr->comFilterIndex))
    {
        /* return whether tm changed, after TMS. */
            ipduPrm.tmChanged = Com_DestDescripTMSHandle(gwyDestDescId, (void*)(&unpackRslt));
    }

    if(0u == (Com_TxIPduRTimeState[(destDescPBTypePtr->comGwDestIPduRefIndex)].txTMSCntr))
    {/* TMS==FALSE */
         ipduPrm.ipduTxMode = COM_CFG_TXMODE_IND_FALSE(txIpduPBPtr->comTxModeFalseIndex);;
         ipduPrm.rptNum = COM_CFG_TXMODE_IND_FALSE_N(txIpduPBPtr->comTxModeFalseIndex);
         ipduPrm.PeriodCntr = COM_CFG_TXMODE_IND_FALSE_PERIODCNTR(txIpduPBPtr->comTxModeFalseIndex);
         ipduPrm.NTimeCntr = COM_CFG_TXMODE_IND_FALSE_NTCNTR(txIpduPBPtr->comTxModeFalseIndex);
    }
    #endif 
    
    /* if the destination signal type is uint8n. */
    if( COM_TXSINGAL_TYPE_UNIT8_N 
    == Com_GetFlagState(destDescPBTypePtr->comGwDestFlag,COM_PBTXSIGNALTYPE_MASK) ) 
    {
        /* if source is description */
        if(TRUE == isFromDesc)
        {
            /* description to description. */
            Com_GtwDescToDesc8NDirectCopy(signalMapId, destObjId, &ipduPrm);
        }
        else
        {
            /* signal to description. */
            Com_GtwSignalToDesc8NDirectCopy(signalMapId, destObjId, &ipduPrm);
        }
    }
    else
    {
        Com_DescDestBuffSet( gwyDestDescId,
                                           destDescPBTypePtr->comGwDestBufIndex, 
                                           &unpackRslt, ipduPrm.signalChanged)
         
        /* if signal changed. */
        if(TRUE == ipduPrm.signalChanged)
        {
             /* executing pack. */
             Com_TxPack(destDescPBTypePtr->comGwDestFlag, destDescPBTypePtr->comGwDestLSBPos, destDescPBTypePtr->comGwDestMSBPos, 
             (void*)(&unpackRslt), &Com_TxIPduRuntimeBuff[txIpduPBPtr->comTxIPduBufIndex]);
        }
    }
    
    #if (STD_ON == COM_UPDATEBIT_ENABLE)
    /* if the description destination has update bit. */
    if(COM_INDEX_DEFAULT != destDescPBTypePtr->comGwDestUpdateBitPos)
    {
        Com_HandleDescUpdateBit(gwyDestDescId, ipduPrm.ipduTxMode, ipduPrm.rptNum)
    }
    #endif
    
    /* if the ipdu group is active, the ipdu including the sending signal will be dealed with*/
    if(Com_GetFlagState( Com_TxIPduRTimeFlag[destDescPBTypePtr->comGwDestIPduRefIndex], 
                                     COM_RT_TXIPDUFLAG_ACTIVE_MASK) > 0u )
    {
        /* If the TM changed, the DM counter will be cleared first. 
        Then the DM, MDT, N-Times N, N-Times Timer counter, PT will
        be set under practical situations. */
        if(TRUE == ipduPrm.tmChanged)
        {
            Com_TxIPduRTimeState[destDescPBTypePtr->comGwDestIPduRefIndex].txDMCntr = 0u;
        }
        
        if(ipduPrm.ipduTxMode != COM_TX_MODE_NONE)
        {  
            /* if TM != NONE, invoke the Com_IpduHandleInSendSignal function. */
            (void)Com_IpduHandleInSendSignal(gwyDestDescId, TRUE, TRUE, &ipduPrm);
        } 
        else
        {
            /* if TM == NONE, clear all Timer counters except for MDT. */
            Com_TxIPduRTimeState[destDescPBTypePtr->comGwDestIPduRefIndex].txRmnTimesOfN = 0u;
            Com_TxIPduRTimeState[destDescPBTypePtr->comGwDestIPduRefIndex].txNTimesPDCntr = 0u;
            Com_TxIPduRTimeState[destDescPBTypePtr->comGwDestIPduRefIndex].txPDCntr = 0u;
            Com_TxIPduRTimeState[destDescPBTypePtr->comGwDestIPduRefIndex].txDMCntr = 0u;
        }
    }

    return;
}
/* SW201459 */
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_GATEWAY_ENABLE */
/* SW201424 */

/* SW201426 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                        handle gateway signal and description source mapping.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant
 * Param-Name[in]        signalMapId
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GwyDSSrcMapHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwyDSSrcMapHandle
(
    uint16 signalMapId
)
{
    #define GWYSRCDESCID (0x7fff & (sigGwMapPBPtr->comGwSrcIndex))
    /* SW201461 */
    P2CONST(Com_SignalGwMapPBType, AUTOMATIC, COM_CONST_PBCFG)
    sigGwMapPBPtr = &(COM_PTR_GWSIGNALMAP(signalMapId));
    /* SW201461 */
    uint16 gwySrcSignalId = sigGwMapPBPtr->comGwSrcIndex;
    P2CONST(Com_GwSourceDescripPBType, AUTOMATIC, COM_CONST_PBCFG)
    srcDescPBPtr = &(COM_PTR_GWSRCDESCPB(GWYSRCDESCID));
    P2CONST(Com_RxSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxSigPBPtr = &(COM_PTR_RXSIGNALPB(gwySrcSignalId));
    uint16 destObjId;

    /* if the gateway map is description */
    if( COM_GWMAP_DESCRIPTION_MARK 
    == (Com_GetFlagState((sigGwMapPBPtr->comGwSrcIndex), COM_GWMAP_DESCRIPTION_MARK)))
    {
        /* if the source description end byte less than input ipdu length. */
        if(srcDescPBPtr->comGwSrcEndByte <= Com_RxIPduRunTimeLength[srcDescPBPtr->comGwSrcIPduRefIndex])
        {      
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            /* if the source description has update bit and update bit is zero, then do nothing. */
            if( (COM_INDEX_DEFAULT != (srcDescPBPtr->comGwSrcUpdateBitPos))&& 
		   /* SW201454 */
                (0 == (Com_GetBitFrm8ByteArr((&(Com_RxIPduRuntimeBuff[COM_CFG_RXIPDU_BUFFINDEX(srcDescPBPtr->comGwSrcIPduRefIndex)])), srcDescPBPtr->comGwSrcUpdateBitPos))))
            {
                /* need not rout. */
            }
            else
            #endif
            {
                uint32 unpackRslt = 0;
                /* if the source description type is uint8n. */
                if( COM_RXSINGAL_TYPE_UNIT8_N != 
                    Com_GetFlagState(srcDescPBPtr->comGwSrcFlag, COM_PBRXSIGNALTYPE_MASK) ) 
                {
                    unpackRslt = Com_RxUnPack( srcDescPBPtr->comGwSrcFlag, srcDescPBPtr->comGwSrcLSBPos, srcDescPBPtr->comGwSrcMSBPos,
                                                               &(Com_RxIPduRuntimeBuff[COM_CFG_RXIPDU_BUFFINDEX(srcDescPBPtr->comGwSrcIPduRefIndex)]) );
                }

                /* loop all destination mapping of the source description */
                for(destObjId = sigGwMapPBPtr->comGwDestIndexStart; 
                     destObjId <= sigGwMapPBPtr->comGwDestIndexStop; 
                     destObjId++)
                {
                    /* if the destination is description. */
                    if(  COM_GWMAP_DESCRIPTION_MARK 
                    == Com_GetFlagState(COM_CFG_DEST_ID(destObjId), COM_GWMAP_DESCRIPTION_MARK))
                    {
                        /* SW201424 */
                        Com_GwyDescSendHandle(signalMapId, destObjId, TRUE, unpackRslt);
                        /* SW201424 */
                    }
                    else
                    {
                        /* SW201425 */
                        Com_GwySignalSendHandle(signalMapId, destObjId, TRUE, unpackRslt);
                        /* SW201425 */
                    }
                }
            }
        }
    }
    else
    {
        /* if the source signal end byte less than input ipdu length. */
        if(rxSigPBPtr->comSignalEndByte <= Com_RxIPduRunTimeLength[rxSigPBPtr->comIPduRefIndex]) 
        {
            #if (STD_ON == COM_UPDATEBIT_ENABLE)
            /* if the source signal has update bit and update bit is zero, then do nothing. */
            if( (COM_INDEX_DEFAULT != (rxSigPBPtr->comSignalUpdateBitPos))&&
                (0u ==  (Com_GetBitFrm8ByteArr((&(Com_RxIPduRuntimeBuff[COM_CFG_RXIPDU_BUFFINDEX(rxSigPBPtr->comIPduRefIndex)])) , rxSigPBPtr->comSignalUpdateBitPos))))
            {
                /* need not rout. */
            }
            else
            #endif
            {
                uint32 unpackRslt = 0;
                /* if the source signal has no invalidate value and filter. */
                if( ( COM_INDEX_DEFAULT == rxSigPBPtr->comSignalInvValueIndex)
                #if (STD_ON == COM_FILTER_ENABLE)
                && (COM_INDEX_DEFAULT == rxSigPBPtr->comFilterFuncIndex) 
                #endif
                )
                {
                    /* get pack value from source signal run time buffer. */
                    switch(Com_GetFlagState(rxSigPBPtr->comSignalPBFlag,COM_PBRXSIGNALTYPE_MASK))          
                    {                                                                                                                                                   
                        case COM_RXSIGNAL_TYPE_BOOLEAN:  
                            unpackRslt = 
                            Com_SignalBoolRuntimeBuff[rxSigPBPtr->comSignalBufIndex];                                                                                                                                                                                 
                            break;                                                                                                                                     
                                                                                                                                                                          
                        case COM_RXSIGNAL_TYPE_SINT8:                                                                                                   
                        case COM_RXSIGNAL_TYPE_UINT8:                                                                                                   
                            unpackRslt = 
                            Com_Signal8BitRuntimeBuff[rxSigPBPtr->comSignalBufIndex];                                                                                                                                            
                            break;                                                                                                                                     
                                                                                                                                                                          
                        case COM_RXSIGNAL_TYPE_SINT16:                                                                                                 
                        case COM_RXSIGNAL_TYPE_UINT16:                                                                                                 
                            unpackRslt = 
                            Com_Signal16BitRuntimeBuff[rxSigPBPtr->comSignalBufIndex];                                                                                                                                        
                            break;                                                                                                                                      
                                                                                                                                                                           
                        case COM_RXSIGNAL_TYPE_UINT32:                                                                                                  
                        case COM_RXSIGNAL_TYPE_SINT32:                                                                                                  
                            unpackRslt = 
                            Com_Signal32BitRuntimeBuff[rxSigPBPtr->comSignalBufIndex];                                                                                                                                           
                            break;                                                                                                                                     
                                                                                                                                                                          
                        default:                                                                                                                                      
                            break;                                                                                                                                    
                    }
                }
                else
                {
                    /* if the source signal type is uint8n. */
                    if( COM_RXSINGAL_TYPE_UNIT8_N != 
                        Com_GetFlagState(rxSigPBPtr->comSignalPBFlag, COM_PBRXSIGNALTYPE_MASK) ) 
                    {
                        unpackRslt = Com_RxUnPack( rxSigPBPtr->comSignalPBFlag, rxSigPBPtr->comSignalLSBPos, rxSigPBPtr->comSignalMSBPos,
                                                                 &(Com_RxIPduRuntimeBuff[COM_CFG_RXIPDU_BUFFINDEX(rxSigPBPtr->comIPduRefIndex)]) );
                    }     
                }

                /* loop all destination mapping of the source signal. */
                for( destObjId = sigGwMapPBPtr->comGwDestIndexStart; 
                      destObjId <= sigGwMapPBPtr->comGwDestIndexStop; 
                      destObjId++ )
                {
                    /* if the destination is description. */
                    if(  COM_GWMAP_DESCRIPTION_MARK 
                    == (Com_GetFlagState(COM_CFG_DEST_ID(destObjId/* SW201455 */), COM_GWMAP_DESCRIPTION_MARK)))
                    {
                        /* SW201424 */
                        Com_GwyDescSendHandle(signalMapId, destObjId, FALSE, unpackRslt);
                        /* SW201424 */
                    }
                    else
                    {
                        /* SW201425 */
                        Com_GwySignalSendHandle(signalMapId, destObjId, FALSE, unpackRslt);
                        /* SW201425 */
                    }
                }
            }
        }
    }

    return;

    #undef GWYSRCDESCID
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_GATEWAY_ENABLE */
/* SW201426 */

/* SW201427 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                        handle gateway group signal updating shadow buffer.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalGrpMapId
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GwySignalGrpUpdateShadowBuff
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalGrpUpdateShadowBuff
(
    uint16 signalGrpMapId
)
{
    uint16 srcGrpSignalID = 0;
    uint16 destGrpSignalInd = 0;
    Com_SignalIdType gwMapRxGrpSigToTxGrpSigId = 0;
    P2CONST(Com_SignalGroupGwMapPBType, AUTOMATIC, COM_CONST_PBCFG)
    signalGrpGwMapPBPtr = &(COM_PTR_GWSIGGRPMAP(signalGrpMapId));
    P2CONST(Com_RxSignalGroupLTType, AUTOMATIC, COM_CONST)
    rxSignalGrpLtPtr = &(Com_RxSignalGroupLT[signalGrpGwMapPBPtr->comGwSrcIndex]);
    P2CONST(Com_RxGroupSignalPBType, AUTOMATIC, COM_CONST_PBCFG)
    rxGrpSignalPbPtr = NULL_PTR;
    

    /* SW201456 */
    /* if the source signal group invalidate handle type is notify or replace. */
    if( (COM_DATA_INVALIDACTION_NOTIFY == (Com_GetFlagState( rxSignalGrpLtPtr->comSignalGroupLTFlag, COM_DATAINVACTION_MASK)))
     ||(COM_DATA_INVALIDACTION_REPLACE == (Com_GetFlagState( rxSignalGrpLtPtr->comSignalGroupLTFlag, COM_DATAINVACTION_MASK))) )
    {
        uint16 rxIpduBufIndex = COM_PTR_RXIPDUPB(COM_PTR_RXSIGGRPPB(signalGrpGwMapPBPtr->comGwSrcIndex).comIPduRefIndex).comRxIPduBufIndex;
        uint32 unpackRslt = 0;

        SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
        /* loop all source group's signals. */
        for( srcGrpSignalID = rxSignalGrpLtPtr->comRxGroupSignalIndexStart; 
              srcGrpSignalID <= rxSignalGrpLtPtr->comRxGroupSignalIndexStop;
              srcGrpSignalID++)
        {
            rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(srcGrpSignalID));
            /* if the source group signal type is unit8n. */
            if(COM_RXSINGAL_TYPE_UNIT8_N != (Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBRXSIGNALTYPE_MASK)))
            {
                /* unpack signal and return the result. */
                unpackRslt = Com_RxUnPack(rxGrpSignalPbPtr->comGroupSignalPBFlag, 
                                                          rxGrpSignalPbPtr->comGroupSignalLSBPos,
                                                          rxGrpSignalPbPtr->comGroupSignalMSBPos,
                                                          &Com_RxIPduRuntimeBuff[rxIpduBufIndex]);
            }

            /* loop all the routing map of this group signal. */
            for( destGrpSignalInd = rxGrpSignalPbPtr->comGwMapToTxGrpSigIdStartIndex;
                  destGrpSignalInd <= rxGrpSignalPbPtr->comGwMapToTxGrpSigIdStopIndex;
                  destGrpSignalInd++)
            {
                gwMapRxGrpSigToTxGrpSigId = COM_CFG_GWRXGRPSIGMAPTO_TXGRPSIGID(destGrpSignalInd);

                /* update destination group signal's shadow buffer with unpack value. */
                /* SW201448 */
                switch(Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBRXSIGNALTYPE_MASK))
                { 
                    case COM_RXSIGNAL_TYPE_BOOLEAN:
                        Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId, FALSE, FALSE, &unpackRslt);
                        break;
                    
                    case COM_RXSIGNAL_TYPE_SINT8:
                    case COM_RXSIGNAL_TYPE_UINT8:
                        Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId, FALSE, FALSE, &unpackRslt); 
                        break;
                    
                    case COM_RXSIGNAL_TYPE_SINT16:
                    case COM_RXSIGNAL_TYPE_UINT16:
                        Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId, FALSE, FALSE, &unpackRslt);
                        break;
                    
                    case COM_RXSIGNAL_TYPE_UINT32:
                    case COM_RXSIGNAL_TYPE_SINT32:
                        Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId, FALSE, FALSE, &unpackRslt);
                        break;  
                    case COM_RXSINGAL_TYPE_UNIT8_N:
                        if( COM_RXSIGNAL_ENDIANESS_BIG
                        == Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBRXSIGENDIANESS_MASK))
                        {
                            #define GWY_RXGRPSIG_IPDUBUFFPOS ((rxGrpSignalPbPtr->comGroupSignalLSBPos) + rxIpduBufIndex)
                            Com_UpdateShadowSignalInternal( gwMapRxGrpSigToTxGrpSigId, TRUE, 
                                                                                 TRUE, &Com_RxIPduRuntimeBuff[GWY_RXGRPSIG_IPDUBUFFPOS]);   
                            #undef GWY_RXGRPSIG_IPDUBUFFPOS
                        }
                        /* SW201440 */
                        else
                        {
                            #define GWY_RXGRPSIG_IPDUBUFFPOS ((rxGrpSignalPbPtr->comGroupSignalLSBPos) + rxIpduBufIndex)
                            Com_UpdateShadowSignalInternal( gwMapRxGrpSigToTxGrpSigId, FALSE, 
                                                                                 TRUE, &Com_RxIPduRuntimeBuff[GWY_RXGRPSIG_IPDUBUFFPOS]);   
                            #undef GWY_RXGRPSIG_IPDUBUFFPOS
                        }
                        /* SW201440 */
                        break;
                    default:
                        break;
                }
                /* SW201448 */
            }
        }
        SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
    }
    else
    {
        SchM_Enter_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);

        /* loop all source group's signals. */
                                    /* SW201453 */
        for(srcGrpSignalID = rxSignalGrpLtPtr->comRxGroupSignalIndexStart; 
		srcGrpSignalID <= rxSignalGrpLtPtr->comRxGroupSignalIndexStop; 
		srcGrpSignalID++)
                                                                                                                 
        {                                                                            /* SW201453 */
            rxGrpSignalPbPtr = &(COM_PTR_RXGRPSIGPB(srcGrpSignalID));

            /* loop all the routing map of this group signal. */
            for( destGrpSignalInd = rxGrpSignalPbPtr->comGwMapToTxGrpSigIdStartIndex;
                  destGrpSignalInd <= rxGrpSignalPbPtr->comGwMapToTxGrpSigIdStopIndex;
                  destGrpSignalInd++)
            {
                gwMapRxGrpSigToTxGrpSigId = COM_CFG_GWRXGRPSIGMAPTO_TXGRPSIGID(destGrpSignalInd);
                /* SW201448 */ 
                /* update destination group signal's shadow buffer with source group signal run time buffer.  */
                switch(Com_GetFlagState(rxGrpSignalPbPtr->comGroupSignalPBFlag, COM_PBRXSIGNALTYPE_MASK)/* SW201453 */)
                {
                    case COM_RXSIGNAL_TYPE_BOOLEAN:
                       Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId, FALSE, FALSE, 
                       &Com_RxGroupSignalBoolRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]);
                       break;
                    
                    case COM_RXSIGNAL_TYPE_SINT8:
                    case COM_RXSIGNAL_TYPE_UINT8:
                    case COM_RXSINGAL_TYPE_UNIT8_N:
                       Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId,  FALSE, FALSE, 
                       &Com_RxGroupSignal8BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]);
                       break;
                    
                    case COM_RXSIGNAL_TYPE_SINT16:
                    case COM_RXSIGNAL_TYPE_UINT16:
                       Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId,  FALSE, FALSE, 
                       &Com_RxGroupSignal16BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]);
                       break;
                    
                    case COM_RXSIGNAL_TYPE_UINT32:
                    case COM_RXSIGNAL_TYPE_SINT32:
                       Com_UpdateShadowSignalInternal(gwMapRxGrpSigToTxGrpSigId,  FALSE, FALSE, 
                       &Com_RxGroupSignal32BitRtimeBuff[rxGrpSignalPbPtr->comGroupSignalBufIndex]);
                       break;                                 
                       default:
                    break;
                }
                /* SW201448 */
            }
        }
        SchM_Exit_Com(COM_INSTANCE_ID, COM_AREA_COMPLETE);
    }
    /* SW201456 */

    return;

}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_GATEWAY_ENABLE */
/* SW201427 */

/* SW201428 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                       handle gateway group signal Sending.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalGrpMapId
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GwySignalGrpSendHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalGrpSendHandle
(
    uint16 signalGrpMapId
)
{
    uint16 destObjId;
    Com_SignalIdType gwDestGrpId = 0;
    IpduHandlePrmType ipduPrm;
    P2CONST(Com_TxModeType, AUTOMATIC, COM_CONST_PBCFG)
    txModePtr = NULL_PTR;
    P2CONST(Com_TxSignalGroupPBType, AUTOMATIC, COM_CONST_PBCFG)
    txSignalGrpPbPtr = NULL_PTR;
    P2VAR(Com_TxIPduStateRTType, AUTOMATIC, COM_VAR)
    txIpduRtStatPtr = NULL_PTR;


    /* loop all the destination signal group mapping of this source signal group. */
    for( destObjId = COM_PTR_GWSIGGRPMAP(signalGrpMapId).comGwDestIndexStart; 
          destObjId <= COM_PTR_GWSIGGRPMAP(signalGrpMapId).comGwDestIndexStop; 
          destObjId++ )
    {
        gwDestGrpId = COM_CFG_DEST_ID(destObjId);
        txSignalGrpPbPtr = &(COM_PTR_TXSIGGRPPB(gwDestGrpId));
        txIpduRtStatPtr = &(Com_TxIPduRTimeState[txSignalGrpPbPtr->comIPduRefIndex]);
        txModePtr = &(COM_PTR_TXMODE(COM_PTR_TXIPDUPB(txSignalGrpPbPtr->comIPduRefIndex).comTxModeTrueIndex)); 

        /* if the filter macro was switch off, the TM parameter will be set with true value. */
        ipduPrm.ipduTxMode = txModePtr->comTxMode;                          
        ipduPrm.rptNum = txModePtr->comTxModeNumOfRepeat;                     
        ipduPrm.PeriodCntr = txModePtr->comTxModeTimePeriod;      
        ipduPrm.NTimeCntr = txModePtr->comTxModeRepeatPeriod;
        ipduPrm.signalChanged = FALSE;
        ipduPrm.tmChanged = FALSE;
		
        #if (STD_ON == COM_FILTER_ENABLE)
        /* if the signal group has been configured filter, do TMS */
        if(COM_INDEX_DEFAULT != (Com_TxSignalGroupLT[gwDestGrpId].comTMCIndex))
        {
            /* return whether tm changed, after TMS. */
            ipduPrm.tmChanged = Com_TxSignalGroupTMSHandle(gwDestGrpId);
        }

        if(0u == (Com_TxIPduRTimeState[(txSignalGrpPbPtr->comIPduRefIndex)].txTMSCntr))                   
        {/* TMS==FALSE */ 
             txModePtr = &(COM_PTR_TXMODE(COM_PTR_TXIPDUPB(txSignalGrpPbPtr->comIPduRefIndex).comTxModeFalseIndex));
             ipduPrm.ipduTxMode = txModePtr->comTxMode;                  
             ipduPrm.rptNum = txModePtr->comTxModeNumOfRepeat;                    
             ipduPrm.PeriodCntr = txModePtr->comTxModeTimePeriod;       
             ipduPrm.NTimeCntr = txModePtr->comTxModeRepeatPeriod;            
        }
        #endif    /* STD_ON == COM_FILTER_ENABLE */

        /* pack signal group. */
        Com_TxPackSignalGroup(gwDestGrpId);

        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        /* according to configuration, handle update bit function. */
        Com_HandleSigGrpUpdateBit(gwDestGrpId, ipduPrm.ipduTxMode, ipduPrm.rptNum)
        #endif    /* STD_ON == COM_UPDATEBIT_ENABLE */

        /* if the ipdu group is active, the ipdu including the sending signal group will be dealed with. */
        if(Com_GetFlagState( Com_TxIPduRTimeFlag[txSignalGrpPbPtr->comIPduRefIndex], 
                                         COM_RT_TXIPDUFLAG_ACTIVE_MASK) > 0u)
        {
            /* DL201419 */
            #if (STD_ON == COM_FILTER_ENABLE)
            /* If the TM changed, the DM counter will be cleared first. 
            Then the DM, MDT, N-Times N, N-Times Timer counter, PT will
            be set under practical situations. */
            if(TRUE == ipduPrm.tmChanged)
            {
                txIpduRtStatPtr->txDMCntr = 0u;
            }
            /* DL201419 */
            #endif    /* STD_ON == COM_FILTER_ENABLE */

            /* if tx mode is not NONE. */
            if(ipduPrm.ipduTxMode != COM_TX_MODE_NONE)
            {
                /* mark:SW201438 */
                (void)Com_IpduHandleInSendSignalGrp(gwDestGrpId, TRUE, &ipduPrm);
                /* mark:SW201438 */
            } 
            else
            {   
                /* if TM == NONE, clear all Timer counters except for MDT. */
                txIpduRtStatPtr->txRmnTimesOfN = 0u;
                txIpduRtStatPtr->txNTimesPDCntr = 0u;
                txIpduRtStatPtr->txPDCntr = 0u;
                txIpduRtStatPtr->txDMCntr = 0u;
            }
        }
    }

    return;
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_GATEWAY_ENABLE */
/* SW201428 */

/* SW201429 */
#if (STD_ON == COM_GATEWAY_ENABLE)
/*************************************************************************/
/*
 * Brief                       handle gateway group signal source mapping.
 * ServiceId                 None
 * Sync/Async             Synchronous
 * Reentrancy              Non Reentrant.
 * Param-Name[in]        signalGrpMapId
 * Param-Name[out]      None
 * Param-Name[in/out]  None
 * Return                None
 * PreCondition        None
 * CallByAPI            Com_GwySignalGrpSrcMapHandle
 */
/*************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
STATIC FUNC(void, COM_CODE)
Com_GwySignalGrpSrcMapHandle
(
    uint16 signalGrpMapId
)
{
    #define GWY_RXSIGGRPREF_IPDUID (COM_PTR_RXSIGGRPPB(signalGrpGwMapPbPtr->comGwSrcIndex).comIPduRefIndex)
    #define GWY_SRCSIGGRP_UPDATEBIT_POS (COM_CFG_RXSIGGRP_UPDATEBITPOS(signalGrpGwMapPbPtr->comGwSrcIndex))

    P2CONST(Com_SignalGroupGwMapPBType, AUTOMATIC, COM_CONST_PBCFG)
    signalGrpGwMapPbPtr = &(COM_PTR_GWSIGGRPMAP(signalGrpMapId));

    /* if source signal group end byte is less then rx ipdu length */
    if(COM_CFG_RXSIGNALGROUP_ENDBYTE(signalGrpGwMapPbPtr->comGwSrcIndex) <= Com_RxIPduRunTimeLength[GWY_RXSIGGRPREF_IPDUID])
    {
        #if (STD_ON == COM_UPDATEBIT_ENABLE)
        /* if the source signal group has update bit. */
        if( (COM_INDEX_DEFAULT != GWY_SRCSIGGRP_UPDATEBIT_POS)
         &&(0u == GetSignalGrpUpdatebit( signalGrpGwMapPbPtr->comGwSrcIndex, 
                       &(Com_RxIPduRuntimeBuff[COM_CFG_RXIPDU_BUFFINDEX(GWY_RXSIGGRPREF_IPDUID)]))))
        {
            /* need not rout. */
        }
        else
        #endif
        {
            Com_GwySignalGrpUpdateShadowBuff(signalGrpMapId);
            Com_GwySignalGrpSendHandle(signalGrpMapId);                     
        }
    } 

	return ;

    #undef GWY_RXSIGGRPREF_IPDUID
    #undef GWY_SRCSIGGRP_UPDATEBIT_POS
}
#define COM_STOP_SEC_CODE
#include "Com_MemMap.h"
#endif    /* STD_ON == COM_GATEWAY_ENABLE */
/* SW201429 */

/*=======[E N D   O F   F I L E]==============================================*/
